hexsha
string | size
int64 | ext
string | lang
string | max_stars_repo_path
string | max_stars_repo_name
string | max_stars_repo_head_hexsha
string | max_stars_repo_licenses
list | max_stars_count
int64 | max_stars_repo_stars_event_min_datetime
string | max_stars_repo_stars_event_max_datetime
string | max_issues_repo_path
string | max_issues_repo_name
string | max_issues_repo_head_hexsha
string | max_issues_repo_licenses
list | max_issues_count
int64 | max_issues_repo_issues_event_min_datetime
string | max_issues_repo_issues_event_max_datetime
string | max_forks_repo_path
string | max_forks_repo_name
string | max_forks_repo_head_hexsha
string | max_forks_repo_licenses
list | max_forks_count
int64 | max_forks_repo_forks_event_min_datetime
string | max_forks_repo_forks_event_max_datetime
string | content
string | avg_line_length
float64 | max_line_length
int64 | alphanum_fraction
float64 | qsc_code_num_words_quality_signal
int64 | qsc_code_num_chars_quality_signal
float64 | qsc_code_mean_word_length_quality_signal
float64 | qsc_code_frac_words_unique_quality_signal
float64 | qsc_code_frac_chars_top_2grams_quality_signal
float64 | qsc_code_frac_chars_top_3grams_quality_signal
float64 | qsc_code_frac_chars_top_4grams_quality_signal
float64 | qsc_code_frac_chars_dupe_5grams_quality_signal
float64 | qsc_code_frac_chars_dupe_6grams_quality_signal
float64 | qsc_code_frac_chars_dupe_7grams_quality_signal
float64 | qsc_code_frac_chars_dupe_8grams_quality_signal
float64 | qsc_code_frac_chars_dupe_9grams_quality_signal
float64 | qsc_code_frac_chars_dupe_10grams_quality_signal
float64 | qsc_code_frac_chars_replacement_symbols_quality_signal
float64 | qsc_code_frac_chars_digital_quality_signal
float64 | qsc_code_frac_chars_whitespace_quality_signal
float64 | qsc_code_size_file_byte_quality_signal
float64 | qsc_code_num_lines_quality_signal
float64 | qsc_code_num_chars_line_max_quality_signal
float64 | qsc_code_num_chars_line_mean_quality_signal
float64 | qsc_code_frac_chars_alphabet_quality_signal
float64 | qsc_code_frac_chars_comments_quality_signal
float64 | qsc_code_cate_xml_start_quality_signal
float64 | qsc_code_frac_lines_dupe_lines_quality_signal
float64 | qsc_code_cate_autogen_quality_signal
float64 | qsc_code_frac_lines_long_string_quality_signal
float64 | qsc_code_frac_chars_string_length_quality_signal
float64 | qsc_code_frac_chars_long_word_length_quality_signal
float64 | qsc_code_frac_lines_string_concat_quality_signal
float64 | qsc_code_cate_encoded_data_quality_signal
float64 | qsc_code_frac_chars_hex_words_quality_signal
float64 | qsc_code_frac_lines_prompt_comments_quality_signal
float64 | qsc_code_frac_lines_assert_quality_signal
float64 | qsc_codepython_cate_ast_quality_signal
float64 | qsc_codepython_frac_lines_func_ratio_quality_signal
float64 | qsc_codepython_cate_var_zero_quality_signal
bool | qsc_codepython_frac_lines_pass_quality_signal
float64 | qsc_codepython_frac_lines_import_quality_signal
float64 | qsc_codepython_frac_lines_simplefunc_quality_signal
float64 | qsc_codepython_score_lines_no_logic_quality_signal
float64 | qsc_codepython_frac_lines_print_quality_signal
float64 | qsc_code_num_words
int64 | qsc_code_num_chars
int64 | qsc_code_mean_word_length
int64 | qsc_code_frac_words_unique
null | qsc_code_frac_chars_top_2grams
int64 | qsc_code_frac_chars_top_3grams
int64 | qsc_code_frac_chars_top_4grams
int64 | qsc_code_frac_chars_dupe_5grams
int64 | qsc_code_frac_chars_dupe_6grams
int64 | qsc_code_frac_chars_dupe_7grams
int64 | qsc_code_frac_chars_dupe_8grams
int64 | qsc_code_frac_chars_dupe_9grams
int64 | qsc_code_frac_chars_dupe_10grams
int64 | qsc_code_frac_chars_replacement_symbols
int64 | qsc_code_frac_chars_digital
int64 | qsc_code_frac_chars_whitespace
int64 | qsc_code_size_file_byte
int64 | qsc_code_num_lines
int64 | qsc_code_num_chars_line_max
int64 | qsc_code_num_chars_line_mean
int64 | qsc_code_frac_chars_alphabet
int64 | qsc_code_frac_chars_comments
int64 | qsc_code_cate_xml_start
int64 | qsc_code_frac_lines_dupe_lines
int64 | qsc_code_cate_autogen
int64 | qsc_code_frac_lines_long_string
int64 | qsc_code_frac_chars_string_length
int64 | qsc_code_frac_chars_long_word_length
int64 | qsc_code_frac_lines_string_concat
null | qsc_code_cate_encoded_data
int64 | qsc_code_frac_chars_hex_words
int64 | qsc_code_frac_lines_prompt_comments
int64 | qsc_code_frac_lines_assert
int64 | qsc_codepython_cate_ast
int64 | qsc_codepython_frac_lines_func_ratio
int64 | qsc_codepython_cate_var_zero
int64 | qsc_codepython_frac_lines_pass
int64 | qsc_codepython_frac_lines_import
int64 | qsc_codepython_frac_lines_simplefunc
int64 | qsc_codepython_score_lines_no_logic
int64 | qsc_codepython_frac_lines_print
int64 | effective
string | hits
int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
365ec265345ef65c5e575925f8df985d501230dd
| 2,204
|
py
|
Python
|
epytope/Data/pssms/smm/mat/B_15_02_9.py
|
christopher-mohr/epytope
|
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
|
[
"BSD-3-Clause"
] | 7
|
2021-02-01T18:11:28.000Z
|
2022-01-31T19:14:07.000Z
|
epytope/Data/pssms/smm/mat/B_15_02_9.py
|
christopher-mohr/epytope
|
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
|
[
"BSD-3-Clause"
] | 22
|
2021-01-02T15:25:23.000Z
|
2022-03-14T11:32:53.000Z
|
epytope/Data/pssms/smm/mat/B_15_02_9.py
|
christopher-mohr/epytope
|
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
|
[
"BSD-3-Clause"
] | 4
|
2021-05-28T08:50:38.000Z
|
2022-03-14T11:45:32.000Z
|
B_15_02_9 = {0: {'A': 0.092, 'C': 0.0, 'E': 0.132, 'D': 0.0, 'G': 0.175, 'F': -0.476, 'I': 0.145, 'H': -0.147, 'K': 0.338, 'M': -0.256, 'L': 0.172, 'N': -0.086, 'Q': -0.041, 'P': 0.0, 'S': -0.196, 'R': 0.415, 'T': -0.025, 'W': -0.116, 'V': 0.115, 'Y': -0.242}, 1: {'A': -0.051, 'C': 0.0, 'E': 0.0, 'D': 0.0, 'G': 0.057, 'F': 0.0, 'I': 0.025, 'H': 0.0, 'K': 0.0, 'M': -0.186, 'L': -0.129, 'N': 0.0, 'Q': 0.136, 'P': 0.0, 'S': 0.002, 'R': 0.0, 'T': 0.045, 'W': 0.0, 'V': 0.1, 'Y': 0.0}, 2: {'A': -0.152, 'C': 0.0, 'E': 0.211, 'D': 0.068, 'G': 0.268, 'F': -0.105, 'I': 0.098, 'H': -0.07, 'K': -0.025, 'M': -0.132, 'L': 0.102, 'N': 0.01, 'Q': -0.127, 'P': 0.0, 'S': 0.124, 'R': -0.07, 'T': 0.016, 'W': 0.014, 'V': -0.098, 'Y': -0.131}, 3: {'A': -0.0, 'C': -0.0, 'E': 0.0, 'D': 0.0, 'G': -0.0, 'F': -0.0, 'I': 0.0, 'H': -0.0, 'K': 0.0, 'M': -0.0, 'L': 0.0, 'N': -0.0, 'Q': -0.0, 'P': 0.0, 'S': 0.0, 'R': -0.0, 'T': 0.0, 'W': 0.0, 'V': -0.0, 'Y': -0.0}, 4: {'A': -0.232, 'C': 0.482, 'E': 0.477, 'D': 0.309, 'G': -0.346, 'F': -0.043, 'I': 0.268, 'H': -0.227, 'K': 0.454, 'M': 0.253, 'L': -0.071, 'N': -0.118, 'Q': -0.079, 'P': -0.435, 'S': -0.398, 'R': -0.029, 'T': -0.129, 'W': -0.168, 'V': 0.012, 'Y': 0.022}, 5: {'A': 0.058, 'C': -0.015, 'E': 0.074, 'D': -0.08, 'G': -0.153, 'F': 0.037, 'I': 0.041, 'H': 0.023, 'K': 0.099, 'M': 0.0, 'L': 0.079, 'N': -0.029, 'Q': 0.005, 'P': 0.031, 'S': -0.081, 'R': -0.069, 'T': -0.024, 'W': -0.03, 'V': 0.007, 'Y': 0.029}, 6: {'A': -0.067, 'C': -0.07, 'E': 0.029, 'D': 0.065, 'G': -0.151, 'F': 0.03, 'I': 0.07, 'H': -0.032, 'K': 0.098, 'M': 0.0, 'L': -0.028, 'N': 0.024, 'Q': -0.149, 'P': 0.129, 'S': -0.187, 'R': -0.068, 'T': 0.005, 'W': 0.141, 'V': 0.163, 'Y': -0.003}, 7: {'A': -0.203, 'C': 0.03, 'E': 0.0, 'D': 0.107, 'G': -0.017, 'F': 0.04, 'I': -0.003, 'H': 0.012, 'K': -0.002, 'M': 0.063, 'L': 0.003, 'N': 0.006, 'Q': 0.032, 'P': -0.078, 'S': 0.031, 'R': 0.027, 'T': -0.034, 'W': -0.004, 'V': 0.002, 'Y': -0.014}, 8: {'A': 0.0, 'C': 0.0, 'E': 1.568, 'D': 0.0, 'G': 0.0, 'F': -0.754, 'I': -0.239, 'H': -0.038, 'K': 0.0, 'M': -0.715, 'L': -1.111, 'N': 0.0, 'Q': 1.192, 'P': 0.0, 'S': 0.0, 'R': 0.0, 'T': 0.0, 'W': 0.336, 'V': 0.469, 'Y': -0.708}, -1: {'con': 3.04223}}
| 2,204
| 2,204
| 0.371143
| 557
| 2,204
| 1.463196
| 0.244165
| 0.120245
| 0.018405
| 0.02454
| 0.209816
| 0.106748
| 0.106748
| 0.094479
| 0.06135
| 0.06135
| 0
| 0.34462
| 0.169238
| 2,204
| 1
| 2,204
| 2,204
| 0.100492
| 0
| 0
| 0
| 0
| 0
| 0.082993
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
366a402a4fd7697d799f454f1b3450ea73c0950e
| 16,673
|
py
|
Python
|
metpy/calc/tests/test_turbulence.py
|
SuccessionEcologicalServices/MetPy
|
2b685023351a89168a7e06c3858ff3493af670e7
|
[
"BSD-3-Clause"
] | null | null | null |
metpy/calc/tests/test_turbulence.py
|
SuccessionEcologicalServices/MetPy
|
2b685023351a89168a7e06c3858ff3493af670e7
|
[
"BSD-3-Clause"
] | null | null | null |
metpy/calc/tests/test_turbulence.py
|
SuccessionEcologicalServices/MetPy
|
2b685023351a89168a7e06c3858ff3493af670e7
|
[
"BSD-3-Clause"
] | null | null | null |
# Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for the `turbulence` module."""
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_equal
import pytest
from metpy.calc.turbulence import friction_velocity, get_perturbation, kinematic_flux, tke
#
# TKE Tests
#
@pytest.fixture()
def uvw_and_known_tke():
"""Provide a set of u,v,w with a known tke value."""
u = np.array([-2, -1, 0, 1, 2])
v = -u
w = 2 * u
# 0.5 * sqrt(2 + 2 + 8)
e_true = np.sqrt(12) / 2.
return u, v, w, e_true
def test_no_tke_1d():
"""Test tke calculation where the expected value is 0."""
observations = 5
# given all the values are the same, there should not be any tke
u = np.ones(observations)
v = np.ones(observations)
w = np.ones(observations)
e_zero = 0
assert_array_equal(e_zero, tke(u, v, w))
def test_no_tke_2d_axis_last():
"""Test 0 tke calculation with 2D arrays; calculation axis is last."""
observations = 5
instruments = 2
# given all the values are the same, there should not be any tke
u = np.ones((instruments, observations))
v = np.ones((instruments, observations))
w = np.ones((instruments, observations))
e_zero = np.zeros(instruments)
assert_array_equal(e_zero, tke(u, v, w, axis=-1))
def test_no_tke_2d_axis_first():
"""Test 0 tke calculation with 2D arrays; calculation axis is first."""
observations = 5
instruments = 2
# given all the values are the same, there should not be any tke
u = np.ones((observations, instruments))
v = np.ones((observations, instruments))
w = np.ones((observations, instruments))
e_zero = np.zeros(instruments)
assert_array_equal(e_zero, tke(u, v, w, axis=0))
def test_known_tke(uvw_and_known_tke):
"""Test basic behavior of tke with known values."""
u, v, w, e_true = uvw_and_known_tke
assert_array_equal(e_true, tke(u, v, w))
def test_known_tke_2d_axis_last(uvw_and_known_tke):
"""Test array with shape (3, 5) [pretend time axis is -1]."""
u, v, w, e_true = uvw_and_known_tke
u = np.array([u, u, u])
v = np.array([v, v, v])
w = np.array([w, w, w])
e_true = e_true * np.ones(3)
assert_array_equal(e_true, tke(u, v, w, axis=-1))
def test_known_tke_2d_axis_first(uvw_and_known_tke):
"""Test array with shape (5, 3) [pretend time axis is 0]."""
u, v, w, e_true = uvw_and_known_tke
u = np.array([u, u, u]).transpose()
v = np.array([v, v, v]).transpose()
w = np.array([w, w, w]).transpose()
e_true = e_true * np.ones(3).transpose()
assert_array_equal(e_true, tke(u, v, w, axis=0))
assert_array_equal(e_true, tke(u, v, w, axis=0, perturbation=True))
#
# Perturbation tests
#
@pytest.fixture()
def pert_zero_mean():
"""Return time series with zero-mean and perturbations."""
ts = np.array([-2, -1, 0, 1, 2])
pert_true = ts.copy()
return ts, pert_true
@pytest.fixture()
def pert_nonzero_mean():
"""Return time seres with non-zero-mean and perturbations."""
ts = np.array([-2, 0, 2, 4, 6])
# ts.mean() = 2
pert_true = np.array([-4, -2, 0, 2, 4])
return ts, pert_true
def test_no_perturbation_1d():
"""Test with uniform data in 1D."""
observations = 5
# given all the values are the same, there should not be perturbations
ts = np.ones(observations)
pert_zero = 0
assert_array_equal(pert_zero, get_perturbation(ts))
def test_no_perturbation_2d_axis_last():
"""Test with uniform data in 2D along the last axis."""
observations = 5
instruments = 2
# given all the values are the same, there should not be perturbations
ts = np.ones((instruments, observations))
pert_zero = np.zeros((instruments, observations))
assert_array_equal(pert_zero, get_perturbation(ts, axis=-1))
def test_no_perturbation_2d_axis_first():
"""Test with uniform data in 2D along the first axis."""
observations = 5
instruments = 2
# given all the values are the same, there should not be perturbations
ts = np.ones((observations, instruments))
pert_zero = np.zeros((observations, instruments))
assert_array_equal(pert_zero, get_perturbation(ts, axis=0))
def test_known_perturbation_zero_mean_1d(pert_zero_mean):
"""Test with zero-mean data in 1D."""
ts, pert_known = pert_zero_mean
assert_array_equal(pert_known, get_perturbation(ts))
def test_known_perturbation_zero_mean_2d_axis_last(pert_zero_mean):
"""Test with zero-mean data in 2D along the last axis."""
ts, pert_known = pert_zero_mean
ts = np.array([ts, ts, ts])
pert_known = np.array([pert_known, pert_known, pert_known])
assert_array_equal(pert_known, get_perturbation(ts, axis=-1))
def test_known_perturbation_zero_mean_2d_axis_first(pert_zero_mean):
"""Test with zero-mean data in 2D along the first axis."""
ts, pert_known = pert_zero_mean
ts = np.array([ts, ts, ts]).transpose()
pert_known = np.array([pert_known, pert_known, pert_known]).transpose()
assert_array_equal(pert_known, get_perturbation(ts, axis=0))
def test_known_perturbation_nonzero_mean_1d(pert_nonzero_mean):
"""Test with non-zero-mean data in 1D."""
ts, pert_known = pert_nonzero_mean
assert_array_equal(pert_known, get_perturbation(ts))
def test_known_perturbation_nonzero_mean_2d_axis_last(pert_nonzero_mean):
"""Test with non-zero-mean data in 2D along the last axis."""
ts, pert_known = pert_nonzero_mean
ts = np.array([ts, ts, ts])
pert_known = np.array([pert_known, pert_known, pert_known])
assert_array_equal(pert_known, get_perturbation(ts, axis=-1))
def test_known_perturbation_nonzero_mean_2d_axis_first(pert_nonzero_mean):
"""Test with non-zero-mean data in 2D along the first axis."""
ts, pert_known = pert_nonzero_mean
ts = np.array([ts, ts, ts]).transpose()
pert_known = np.array([pert_known, pert_known, pert_known]).transpose()
assert_array_equal(pert_known, get_perturbation(ts, axis=0))
#
# Kinematic Flux Tests
#
@pytest.fixture()
def uvw_and_known_kf_zero_mean():
"""Return components and kinematic flux for zero-mean time series."""
u = np.array([-2, -1, 0, 1, 2])
v = -u
w = 2 * u
kf_true = {'uv': -2, 'uw': 4, 'vw': -4}
return u, v, w, kf_true
@pytest.fixture()
def uvw_and_known_kf_nonzero_mean():
"""Return components and kinematic flux for non-zero-mean time series."""
u = np.array([-2, -1, 0, 1, 5])
v = -u
w = 2 * u
kf_true = {'uv': -5.84, 'uw': 11.68, 'vw': -11.68}
return u, v, w, kf_true
def test_kf_1d_zero_mean(uvw_and_known_kf_zero_mean):
"""Test kinematic flux calculation in 1D with zero-mean time series."""
u, v, w, kf_true = uvw_and_known_kf_zero_mean
assert_array_equal(kinematic_flux(u, v, perturbation=False),
kf_true['uv'])
assert_array_equal(kinematic_flux(u, w, perturbation=False),
kf_true['uw'])
assert_array_equal(kinematic_flux(v, w, perturbation=False),
kf_true['vw'])
# given u, v, and w have a zero mean, the kf computed with
# perturbation=True and perturbation=False should be the same
assert_array_equal(kinematic_flux(u, v, perturbation=False),
kinematic_flux(u, v, perturbation=True))
assert_array_equal(kinematic_flux(u, w, perturbation=False),
kinematic_flux(u, w, perturbation=True))
assert_array_equal(kinematic_flux(v, w, perturbation=False),
kinematic_flux(v, w, perturbation=True))
def test_kf_1d_nonzero_mean(uvw_and_known_kf_nonzero_mean):
"""Test kinematic flux calculation in 1D with non-zero-mean time series."""
u, v, w, kf_true = uvw_and_known_kf_nonzero_mean
assert_array_equal(kinematic_flux(u, v, perturbation=False),
kf_true['uv'])
assert_array_equal(kinematic_flux(u, w, perturbation=False),
kf_true['uw'])
assert_array_equal(kinematic_flux(v, w, perturbation=False),
kf_true['vw'])
def test_kf_2d_axis_last_zero_mean(uvw_and_known_kf_zero_mean):
"""Test kinematic flux calculation in 2D with zero-mean time series along last axis."""
u, v, w, kf_true = uvw_and_known_kf_zero_mean
u = np.array([u, u, u])
v = np.array([v, v, v])
w = np.array([w, w, w])
for key in kf_true.keys():
tmp = kf_true[key]
kf_true[key] = np.array([tmp, tmp, tmp])
assert_array_equal(kinematic_flux(u, v, perturbation=False, axis=-1),
kf_true['uv'])
assert_array_equal(kinematic_flux(u, w, perturbation=False, axis=-1),
kf_true['uw'])
assert_array_equal(kinematic_flux(v, w, perturbation=False, axis=-1),
kf_true['vw'])
# given u, v, and w have a zero mean, the kf computed with
# perturbation=True and perturbation=False should be the same
assert_array_equal(kinematic_flux(u, v, perturbation=False, axis=-1),
kinematic_flux(u, v, perturbation=True, axis=-1))
assert_array_equal(kinematic_flux(u, w, perturbation=False, axis=-1),
kinematic_flux(u, w, perturbation=True, axis=-1))
assert_array_equal(kinematic_flux(v, w, perturbation=False, axis=-1),
kinematic_flux(v, w, perturbation=True, axis=-1))
def test_kf_2d_axis_last_nonzero_mean(uvw_and_known_kf_nonzero_mean):
"""Test kinematic flux calculation in 2D with non-zero-mean time series along last axis."""
u, v, w, kf_true = uvw_and_known_kf_nonzero_mean
u = np.array([u, u, u])
v = np.array([v, v, v])
w = np.array([w, w, w])
for key in kf_true.keys():
tmp = kf_true[key]
kf_true[key] = np.array([tmp, tmp, tmp])
assert_array_equal(kinematic_flux(u, v, perturbation=False, axis=-1),
kf_true['uv'])
assert_array_equal(kinematic_flux(u, w, perturbation=False, axis=-1),
kf_true['uw'])
assert_array_equal(kinematic_flux(v, w, perturbation=False, axis=-1),
kf_true['vw'])
def test_kf_2d_axis_first_zero_mean(uvw_and_known_kf_zero_mean):
"""Test kinematic flux calculation in 2D with zero-mean time series along first axis."""
u, v, w, kf_true = uvw_and_known_kf_zero_mean
u = np.array([u, u, u]).transpose()
v = np.array([v, v, v]).transpose()
w = np.array([w, w, w]).transpose()
for key in kf_true.keys():
tmp = kf_true[key]
kf_true[key] = np.array([tmp, tmp, tmp]).transpose()
assert_array_equal(kinematic_flux(u, v, perturbation=False, axis=0),
kf_true['uv'])
assert_array_equal(kinematic_flux(u, w, perturbation=False, axis=0),
kf_true['uw'])
assert_array_equal(kinematic_flux(v, w, perturbation=False, axis=0),
kf_true['vw'])
# given u, v, and w have a zero mean, the kf computed with
# perturbation=True and perturbation=False should be the same
assert_array_equal(kinematic_flux(u, v, perturbation=False, axis=0),
kinematic_flux(u, v, perturbation=True, axis=0))
assert_array_equal(kinematic_flux(u, w, perturbation=False, axis=0),
kinematic_flux(u, w, perturbation=True, axis=0))
assert_array_equal(kinematic_flux(v, w, perturbation=False, axis=0),
kinematic_flux(v, w, perturbation=True, axis=0))
def test_kf_2d_axis_first_nonzero_mean(uvw_and_known_kf_nonzero_mean):
"""Test kinematic flux in 2D with non-zero-mean time series along first axis."""
u, v, w, kf_true = uvw_and_known_kf_nonzero_mean
u = np.array([u, u, u]).transpose()
v = np.array([v, v, v]).transpose()
w = np.array([w, w, w]).transpose()
for key in kf_true.keys():
tmp = kf_true[key]
kf_true[key] = np.array([tmp, tmp, tmp]).transpose()
assert_array_equal(kinematic_flux(u, v, perturbation=False, axis=0),
kf_true['uv'])
assert_array_equal(kinematic_flux(u, w, perturbation=False, axis=0),
kf_true['uw'])
assert_array_equal(kinematic_flux(v, w, perturbation=False, axis=0),
kf_true['vw'])
#
# Friction Velocity Tests
#
@pytest.fixture()
def uvw_and_known_u_star_zero_mean():
"""Return components and friction velocity for a zero-mean time series."""
u = np.array([-2, -1, 0, 1, 2])
v = -u
w = 2 * u
u_star_true = {'uw': 2.0, 'uwvw': 2.3784142300054421}
return u, v, w, u_star_true
@pytest.fixture()
def uvw_and_known_u_star_nonzero_mean():
"""Return components and friction velocity for a non-zero-mean time series."""
u = np.array([-2, -1, 0, 1, 5])
v = -u
w = 2 * u
u_star_true = {'uw': 3.4176014981270124, 'uwvw': 4.0642360178166017}
return u, v, w, u_star_true
def test_u_star_1d_zero_mean(uvw_and_known_u_star_zero_mean):
"""Test friction velocity in 1D with a zero-mean time series."""
u, v, w, u_star_true = uvw_and_known_u_star_zero_mean
assert_almost_equal(friction_velocity(u, w, perturbation=False),
u_star_true['uw'])
assert_almost_equal(friction_velocity(u, w, v=v, perturbation=False),
u_star_true['uwvw'])
def test_u_star_1d_nonzero_mean(uvw_and_known_u_star_nonzero_mean):
"""Test friction velocity in 1D with a non-zero-mean time series."""
u, v, w, u_star_true = uvw_and_known_u_star_nonzero_mean
assert_almost_equal(friction_velocity(u, w, perturbation=False),
u_star_true['uw'])
assert_almost_equal(friction_velocity(u, w, v=v, perturbation=False),
u_star_true['uwvw'])
def test_u_star_2d_axis_last_zero_mean(uvw_and_known_u_star_zero_mean):
"""Test friction velocity in 2D with a zero-mean time series along the last axis."""
u, v, w, u_star_true = uvw_and_known_u_star_zero_mean
u = np.array([u, u, u])
v = np.array([v, v, v])
w = np.array([w, w, w])
for key in u_star_true.keys():
tmp = u_star_true[key]
u_star_true[key] = np.array([tmp, tmp, tmp])
assert_almost_equal(friction_velocity(u, w, perturbation=False,
axis=-1), u_star_true['uw'])
assert_almost_equal(friction_velocity(u, w, v=v, perturbation=False,
axis=-1), u_star_true['uwvw'])
def test_u_star_2d_axis_last_nonzero_mean(uvw_and_known_u_star_nonzero_mean):
"""Test friction velocity in 2D with a non-zero-mean time series along the last axis."""
u, v, w, u_star_true = uvw_and_known_u_star_nonzero_mean
u = np.array([u, u, u])
v = np.array([v, v, v])
w = np.array([w, w, w])
for key in u_star_true.keys():
tmp = u_star_true[key]
u_star_true[key] = np.array([tmp, tmp, tmp])
assert_almost_equal(friction_velocity(u, w, perturbation=False,
axis=-1), u_star_true['uw'])
assert_almost_equal(friction_velocity(u, w, v=v, perturbation=False,
axis=-1), u_star_true['uwvw'])
def test_u_star_2d_axis_first_zero_mean(uvw_and_known_u_star_zero_mean):
"""Test friction velocity in 2D with a zero-mean time series along the first axis."""
u, v, w, u_star_true = uvw_and_known_u_star_zero_mean
u = np.array([u, u, u]).transpose()
v = np.array([v, v, v]).transpose()
w = np.array([w, w, w]).transpose()
for key in u_star_true.keys():
tmp = u_star_true[key]
u_star_true[key] = np.array([tmp, tmp, tmp]).transpose()
assert_almost_equal(friction_velocity(u, w, perturbation=False,
axis=0), u_star_true['uw'])
assert_almost_equal(friction_velocity(u, w, v=v, perturbation=False,
axis=0), u_star_true['uwvw'])
def test_u_star_2d_axis_first_nonzero_mean(uvw_and_known_u_star_nonzero_mean):
"""Test friction velocity in 2D with a non-zero-mean time series along the first axis."""
u, v, w, u_star_true = uvw_and_known_u_star_nonzero_mean
u = np.array([u, u, u]).transpose()
v = np.array([v, v, v]).transpose()
w = np.array([w, w, w]).transpose()
for key in u_star_true.keys():
tmp = u_star_true[key]
u_star_true[key] = np.array([tmp, tmp, tmp]).transpose()
assert_almost_equal(friction_velocity(u, w, perturbation=False,
axis=0), u_star_true['uw'])
assert_almost_equal(friction_velocity(u, w, v=v, perturbation=False,
axis=0), u_star_true['uwvw'])
| 39.792363
| 95
| 0.65723
| 2,634
| 16,673
| 3.899013
| 0.049355
| 0.044401
| 0.068549
| 0.065725
| 0.883155
| 0.871568
| 0.845667
| 0.80224
| 0.746641
| 0.697468
| 0
| 0.01884
| 0.216878
| 16,673
| 418
| 96
| 39.88756
| 0.767711
| 0.187549
| 0
| 0.699647
| 0
| 0
| 0.007195
| 0
| 0
| 0
| 0
| 0
| 0.19788
| 1
| 0.120141
| false
| 0
| 0.014134
| 0
| 0.159011
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
3d18065b904462505d779f8775ae89a07025dddc
| 142
|
py
|
Python
|
Marlin/scripts/due_pins.py
|
tadawson/Marlin4Due-Dawson
|
710764472a95128264bd9bea376cb15caf15208b
|
[
"RSA-MD"
] | null | null | null |
Marlin/scripts/due_pins.py
|
tadawson/Marlin4Due-Dawson
|
710764472a95128264bd9bea376cb15caf15208b
|
[
"RSA-MD"
] | null | null | null |
Marlin/scripts/due_pins.py
|
tadawson/Marlin4Due-Dawson
|
710764472a95128264bd9bea376cb15caf15208b
|
[
"RSA-MD"
] | null | null | null |
__author__ = 'Nico'
for i in range(0, 87+1):
print('#define DIO{0}_PIN '.format(i))
print('#define DIO{0}_WPORT PIO\n'.format(i))
| 28.4
| 49
| 0.612676
| 25
| 142
| 3.24
| 0.68
| 0.271605
| 0.345679
| 0.37037
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.051724
| 0.183099
| 142
| 5
| 49
| 28.4
| 0.646552
| 0
| 0
| 0
| 0
| 0
| 0.352518
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 6
|
3d24f7c9384f89705b46866f7f7f403fd958ccc9
| 12,404
|
py
|
Python
|
ptuner/spaces/tests/test_classifiers.py
|
rmill040/ptuner
|
bf76ca75ad79a0def7965dd29f3e44056b1d8f09
|
[
"MIT"
] | 1
|
2020-06-24T16:04:44.000Z
|
2020-06-24T16:04:44.000Z
|
ptuner/spaces/tests/test_classifiers.py
|
rmill040/ptuner
|
bf76ca75ad79a0def7965dd29f3e44056b1d8f09
|
[
"MIT"
] | null | null | null |
ptuner/spaces/tests/test_classifiers.py
|
rmill040/ptuner
|
bf76ca75ad79a0def7965dd29f3e44056b1d8f09
|
[
"MIT"
] | null | null | null |
from math import log
import pandas as pd
import pytest
import re
# Package imports
from ptuner.spaces import LightGBMClassifierSampler, MLPClassifierSampler, XGBClassifierSampler
from ptuner.utils import helper
@pytest.mark.parametrize("dynamic_update", [True, False])
@pytest.mark.parametrize("early_stopping", [True, False])
def test_lightgbm_classifier_sampler(dynamic_update, early_stopping):
"""Tests LightGBMClassifierSampler.
"""
# Define sampler
sampler = LightGBMClassifierSampler(
dynamic_update=dynamic_update,
early_stopping=early_stopping,
seed=1718
)
# Check 1. Make sure sampling changes values within bounds defined by user
df_configs = pd.DataFrame([sampler.sample_space() for _ in range(20)])
for column in df_configs:
# Remember this hyperparameter should stay fixed
if column == 'random_state':
assert(df_configs[column].unique()[0] == 1718), \
"random_state should not change during sampling"
continue
if column == 'class_weight':
assert(set(df_configs[column].unique()) == {'balanced', None}), \
"sampling generated incorrect values for %s, check sampling scheme" % column
# Other hyperparameters should change across samples
assert(df_configs[column].unique().shape[0] > 1), \
"sampling generated constant values for %s, check sampling scheme" % column
# Check 2. Check dynamic updating and early_stopping features if enabled
df_configs = df_configs.sort_values(by="learning_rate", ascending=True)
df_hof = df_configs.copy(deep=True).iloc[:5]
# Force minimum number of estimators to be greater than 10 for later assertion check
df_hof.loc[df_hof['n_estimators'] == 10, 'n_estimators'] = 11
# Now update space based on 'hof' candidates
sampler.update_space(df_hof)
for column in df_hof:
# Skip these parameters
if column in ['random_state', 'class_weight']: continue
actual_min = df_hof[column].min()
actual_max = df_hof[column].max()
param_type, hp_bounds = helper.parse_hyperopt_param(str(sampler.space[column]))
# For necessary hyperparameters, make sure scale is correct
if param_type == 'loguniform':
actual_min = log(actual_min)
actual_max = log(actual_max)
# Handle n_estimators for specific cases
if column == 'n_estimators':
if dynamic_update:
# With dynamic updates, having early stopping with DISABLE parameter
# updates
if early_stopping:
assert(actual_min > hp_bounds[0]), \
"n_estimators should not be updated with early stopping enabled, " + \
"even with dynamic update enabled"
continue
# With dynamic updates, not having early stopping will ENABLE parameter
# updates
else:
assert(actual_min == hp_bounds[0]), \
"n_estimators should be updated with dynamic update and " + \
"early stopping disabled"
continue
if dynamic_update:
assert(actual_min == hp_bounds[0]), \
"lower bound did not update correctly for %s during space update" % column
assert(actual_max == hp_bounds[1]), \
"upper bound did not update correctly for %s during space update" % column
else:
assert(actual_min >= hp_bounds[0]), \
"lower bound did not update correctly for %s during space update" % column
assert(actual_max <= hp_bounds[1]), \
"upper bound did not update correctly for %s during space update" % column
@pytest.mark.parametrize("dynamic_update", [True, False])
@pytest.mark.parametrize("early_stopping", [True, False])
@pytest.mark.parametrize("n_hidden_layers", [1, 2])
@pytest.mark.parametrize("max_neurons", [256, 512])
@pytest.mark.parametrize("max_epochs", [10, 25])
def test_mlp_classifier_sampler(
dynamic_update,
early_stopping,
n_hidden_layers,
max_neurons,
max_epochs
):
"""Test MLPClassifierSampler.
"""
# Define sampler
sampler = MLPClassifierSampler(
dynamic_update=dynamic_update,
early_stopping=early_stopping,
n_hidden_layers=n_hidden_layers,
max_neurons=max_neurons,
max_epochs=max_epochs,
seed=None # No seed
)
# Check 1. See if sampler is initialized with correct number of hidden layers
assert(sampler.space['n_hidden_layers'] == n_hidden_layers), \
"sampler initialized with incorrect number of hidden layers"
# Check 2. See if correct number of hidden unit parameters are defined
names = filter(lambda x: 'n_hidden' in x and 'layers' not in x, sampler.space.keys())
cols2check = ['n_hidden%s' % i for i in range(1, n_hidden_layers+1)]
assert(set(names) == set(cols2check)), \
"number of hidden unit parameters not defined correctly, check starting space"
# Check 3. Make sure sampling changes values within bounds defined by user
df_configs = pd.DataFrame([sampler.sample_space() for _ in range(20)])
for column in df_configs:
# Remember this hyperparameter should stay fixed
if column == 'n_hidden_layers':
assert(df_configs[column].unique()[0] == n_hidden_layers), \
"n_hidden_layers should not change during sampling"
continue
# Other hyperparameters should change across samples
assert(df_configs[column].unique().shape[0] > 1), \
"sampling generated constant values for %s, check sampling scheme" % column
# Check 4. Make sure number of hidden units and epochs do not exceed bounds
# specified by user
for column in cols2check + ['epochs']:
max_sampled = max([sampler.sample_space()[column] for _ in range(100)])
if column == 'epochs':
assert(max_sampled <= max_epochs), \
"sampled epoch higher than max epochs, check constraints"
else:
assert(max_sampled <= max_neurons), \
"sampled %s higher than max neurons, check constraints" % column
# Check 5. Make sure dynamic updating is working based on made up data
df_configs = df_configs.sort_values(by="dropout", ascending=True)
df_hof = df_configs.copy(deep=True).iloc[:5]
# Force minimum number of epochs to be greater than 1 for later assertion check
df_hof.loc[df_hof['epochs'] == 1, 'epochs'] = 2
# Now update space based on 'hof' candidates
sampler.update_space(df_hof)
for column in df_hof:
# These are categorical distributions so skip
if column in ['batch_norm', 'optimizer', 'n_hidden_layers']: continue
actual_min = df_hof[column].min()
actual_max = df_hof[column].max()
param_type, hp_bounds = helper.parse_hyperopt_param(str(sampler.space[column]))
# For necessary hyperparameters, make sure scale is correct
if param_type == 'loguniform':
actual_min = log(actual_min)
actual_max = log(actual_max)
# Handle n_estimators for specific cases
if column == 'epochs':
if dynamic_update:
# With dynamic updates, having early stopping with DISABLE parameter
# updates
if early_stopping:
assert(actual_min > hp_bounds[0]), \
"epochs should not be updated with early stopping enabled, " + \
"even with dynamic update enabled"
continue
# With dynamic updates, not having early stopping will ENABLE parameter
# updates
else:
assert(actual_min == hp_bounds[0]), \
"epochs should be updated with dynamic update and " + \
"early stopping disabled"
continue
if dynamic_update:
assert(actual_min == hp_bounds[0]), \
"lower bound did not update correctly for %s during space update" % column
assert(actual_max == hp_bounds[1]), \
"upper bound did not update correctly for %s during space update" % column
else:
assert(actual_min >= hp_bounds[0]), \
"lower bound did not update correctly for %s during space update" % column
assert(actual_max <= hp_bounds[1]), \
"upper bound did not update correctly for %s during space update" % column
@pytest.mark.parametrize("dynamic_update", [True, False])
@pytest.mark.parametrize("early_stopping", [True, False])
def test_xgb_classifier_sampler(dynamic_update, early_stopping):
"""Tests XGBClassifierSampler.
"""
# Define sampler
sampler = XGBClassifierSampler(
dynamic_update=dynamic_update,
early_stopping=early_stopping,
seed=1718
)
# Check 1. Make sure sampling changes values within bounds defined by user
df_configs = pd.DataFrame([sampler.sample_space() for _ in range(20)])
for column in df_configs:
# Remember this hyperparameter should stay fixed
if column == 'random_state':
assert(df_configs[column].unique()[0] == 1718), \
"random_state should not change during sampling"
continue
# Other hyperparameters should change across samples
assert(df_configs[column].unique().shape[0] > 1), \
"sampling generated constant values for %s, check sampling scheme" % column
# Check 2. Check dynamic updating and early_stopping features if enabled
df_configs = df_configs.sort_values(by="learning_rate", ascending=True)
df_hof = df_configs.copy(deep=True).iloc[:5]
# Force minimum number of estimators to be greater than 10 for later assertion check
df_hof.loc[df_hof['n_estimators'] == 10, 'n_estimators'] = 11
# Now update space based on 'hof' candidates
sampler.update_space(df_hof)
for column in df_hof:
# Skip this parameter
if column == 'random_state': continue
actual_min = df_hof[column].min()
actual_max = df_hof[column].max()
param_type, hp_bounds = helper.parse_hyperopt_param(str(sampler.space[column]))
# For necessary hyperparameters, make sure scale is correct
if param_type == 'loguniform':
actual_min = log(actual_min)
actual_max = log(actual_max)
# Handle n_estimators for specific cases
if column == 'n_estimators':
if dynamic_update:
# With dynamic updates, having early stopping with DISABLE parameter
# updates
if early_stopping:
assert(actual_min > hp_bounds[0]), \
"n_estimators should not be updated with early stopping enabled, " + \
"even with dynamic update enabled"
continue
# With dynamic updates, not having early stopping will ENABLE parameter
# updates
else:
assert(actual_min == hp_bounds[0]), \
"n_estimators should be updated with dynamic update and " + \
"early stopping disabled"
continue
if dynamic_update:
assert(actual_min == hp_bounds[0]), \
"lower bound did not update correctly for %s during space update" % column
assert(actual_max == hp_bounds[1]), \
"upper bound did not update correctly for %s during space update" % column
else:
assert(actual_min >= hp_bounds[0]), \
"lower bound did not update correctly for %s during space update" % column
assert(actual_max <= hp_bounds[1]), \
"upper bound did not update correctly for %s during space update" % column
| 42.479452
| 95
| 0.614882
| 1,450
| 12,404
| 5.10069
| 0.138621
| 0.050974
| 0.024337
| 0.027582
| 0.792591
| 0.78218
| 0.75676
| 0.734992
| 0.726339
| 0.721606
| 0
| 0.011129
| 0.304579
| 12,404
| 292
| 96
| 42.479452
| 0.846279
| 0.18881
| 0
| 0.713514
| 0
| 0
| 0.2359
| 0
| 0
| 0
| 0
| 0
| 0.156757
| 1
| 0.016216
| false
| 0
| 0.032432
| 0
| 0.048649
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
e9fb0bc0f91e0135f34140cea7dafc0c5476e48f
| 100
|
py
|
Python
|
llvm/utils/lit/tests/Inputs/shtest-not/fail2.py
|
mkinsner/llvm
|
589d48844edb12cd357b3024248b93d64b6760bf
|
[
"Apache-2.0"
] | 2,338
|
2018-06-19T17:34:51.000Z
|
2022-03-31T11:00:37.000Z
|
llvm/utils/lit/tests/Inputs/shtest-not/fail2.py
|
mkinsner/llvm
|
589d48844edb12cd357b3024248b93d64b6760bf
|
[
"Apache-2.0"
] | 3,740
|
2019-01-23T15:36:48.000Z
|
2022-03-31T22:01:13.000Z
|
llvm/utils/lit/tests/Inputs/shtest-not/fail2.py
|
mkinsner/llvm
|
589d48844edb12cd357b3024248b93d64b6760bf
|
[
"Apache-2.0"
] | 500
|
2019-01-23T07:49:22.000Z
|
2022-03-30T02:59:37.000Z
|
#!/usr/bin/env python
import print_environment
import sys
print_environment.execute()
sys.exit(2)
| 12.5
| 27
| 0.79
| 15
| 100
| 5.133333
| 0.733333
| 0.415584
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011111
| 0.1
| 100
| 7
| 28
| 14.285714
| 0.844444
| 0.2
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0.5
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
|
0
| 6
|
1830a30938984d77f985624004052868b3a8a99d
| 24
|
py
|
Python
|
sucuri/__init__.py
|
sirvan3tr/sucuri
|
edc0d9cf9d32258e3e043cf859da22ec33852da1
|
[
"BSD-3-Clause"
] | 24
|
2018-03-22T18:22:52.000Z
|
2021-04-19T18:56:19.000Z
|
sucuri/__init__.py
|
sirvan3tr/sucuri
|
edc0d9cf9d32258e3e043cf859da22ec33852da1
|
[
"BSD-3-Clause"
] | 27
|
2018-03-20T17:34:24.000Z
|
2020-08-08T22:30:50.000Z
|
sucuri/__init__.py
|
sirvan3tr/sucuri
|
edc0d9cf9d32258e3e043cf859da22ec33852da1
|
[
"BSD-3-Clause"
] | 19
|
2018-05-10T17:40:23.000Z
|
2022-02-22T19:33:26.000Z
|
from .files import Files
| 24
| 24
| 0.833333
| 4
| 24
| 5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 24
| 1
| 24
| 24
| 0.952381
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
1868c7ef10d64aa2559c2c8039e2e771034792cf
| 133
|
py
|
Python
|
app/content_management/__init__.py
|
mwhittemore2/vocab_manager
|
05d8ec2bac925a53e1882c645f5e086a540bfe6b
|
[
"MIT"
] | null | null | null |
app/content_management/__init__.py
|
mwhittemore2/vocab_manager
|
05d8ec2bac925a53e1882c645f5e086a540bfe6b
|
[
"MIT"
] | null | null | null |
app/content_management/__init__.py
|
mwhittemore2/vocab_manager
|
05d8ec2bac925a53e1882c645f5e086a540bfe6b
|
[
"MIT"
] | null | null | null |
from flask import Blueprint
#Set up content management blueprint
cm = Blueprint('content_management', __name__)
from . import views
| 22.166667
| 46
| 0.804511
| 17
| 133
| 6
| 0.647059
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135338
| 133
| 6
| 47
| 22.166667
| 0.886957
| 0.263158
| 0
| 0
| 0
| 0
| 0.183673
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0.666667
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
|
0
| 6
|
43e8a062448359cc1db6cb4caf0932b6359f0ab4
| 76
|
py
|
Python
|
notedrive/base/__init__.py
|
notechats/notepan
|
be63bad0cb6b26ec1990862bf4c9e04172bacb31
|
[
"Apache-2.0"
] | 24
|
2020-02-26T03:56:46.000Z
|
2022-03-18T07:15:26.000Z
|
notedrive/base/__init__.py
|
notechats/notepan
|
be63bad0cb6b26ec1990862bf4c9e04172bacb31
|
[
"Apache-2.0"
] | 2
|
2020-05-02T19:52:20.000Z
|
2021-07-11T07:19:44.000Z
|
notedrive/base/__init__.py
|
notechats/notepan
|
be63bad0cb6b26ec1990862bf4c9e04172bacb31
|
[
"Apache-2.0"
] | 5
|
2020-10-15T11:33:25.000Z
|
2022-01-25T17:42:21.000Z
|
from .core import MultiThreadDownload, SingleThreadDownload, PyCurlDownLoad
| 38
| 75
| 0.881579
| 6
| 76
| 11.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078947
| 76
| 1
| 76
| 76
| 0.957143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
a115a0e8838c66436fb4d1fce9879553dd6889bb
| 236
|
py
|
Python
|
testing.py
|
Jeanne-Chris/DXCPythonBootcamp
|
9d394035a700d4364acfebf80316cb6281a5776b
|
[
"MIT"
] | 1
|
2022-03-03T09:54:06.000Z
|
2022-03-03T09:54:06.000Z
|
testing.py
|
Jeanne-Chris/DXCPythonBootcamp
|
9d394035a700d4364acfebf80316cb6281a5776b
|
[
"MIT"
] | null | null | null |
testing.py
|
Jeanne-Chris/DXCPythonBootcamp
|
9d394035a700d4364acfebf80316cb6281a5776b
|
[
"MIT"
] | null | null | null |
import mathfuncs
#import pytest
def test_add():
assert mathfuncs.add(7, 3) == 10
assert mathfuncs.add(7) == 9
def test_multiply():
assert mathfuncs.multiply(7, 3) == 21
assert mathfuncs.multiply(7, 2) == 14
| 21.454545
| 42
| 0.635593
| 33
| 236
| 4.484848
| 0.454545
| 0.405405
| 0.243243
| 0.256757
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.077778
| 0.237288
| 236
| 10
| 43
| 23.6
| 0.744444
| 0.055085
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.571429
| 1
| 0.285714
| true
| 0
| 0.142857
| 0
| 0.428571
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a1185c3527f92f65c4474220aeb4474831087364
| 2,595
|
py
|
Python
|
init_scripts/load_default_tasks.py
|
kelceydamage/axol
|
b5288577ee769bcd609c361cb0ac5e2a678289da
|
[
"Apache-2.0"
] | null | null | null |
init_scripts/load_default_tasks.py
|
kelceydamage/axol
|
b5288577ee769bcd609c361cb0ac5e2a678289da
|
[
"Apache-2.0"
] | null | null | null |
init_scripts/load_default_tasks.py
|
kelceydamage/axol
|
b5288577ee769bcd609c361cb0ac5e2a678289da
|
[
"Apache-2.0"
] | null | null | null |
#! /usr/bin/env python
#-----------------------------------------#
# Written by Kelcey Damage, 2013
# Imports
#-----------------------------------------------------------------------#
import urllib2
import time
# Main script
#-----------------------------------------------------------------------#
# research
axol_scheduler = 'ip-address'
def register_scheduler_task(axol_scheduler, api_name, func, method, time, role):
response = urllib2.urlopen(
'http://%s/api/scheduler/schedule/%s/%s/%s/%s/%s' % (
axol_scheduler,
api_name,
func,
method,
time,
role
)
)
print 'http://%s/api/scheduler/schedule/%s/%s/%s/%s/%s' % (
axol_scheduler,
api_name,
func,
method,
time,
role
)
return response.read()
# Default tasks to load
#-----------------------------------------------------------------------#
#roles = 'hq_api_servers'
roles = 'production_servers'
'''
register_scheduler_task(
axol_scheduler,
'network',
'heartbeat',
'usage',
15,
'production_servers'
)
time.sleep(4)
'''
register_scheduler_task(
axol_scheduler,
'system',
'memory',
'stats',
15,
roles
)
print 'sleep 5'
time.sleep(5)
register_scheduler_task(
axol_scheduler,
'system',
'cpu',
'usage',
15,
roles
)
print 'sleep 5'
time.sleep(5)
roles = 'mysql_servers'
register_scheduler_task(
axol_scheduler,
'plugins',
'mysql',
'performance',
15,
roles
)
roles = 'production_servers'
register_scheduler_task(
axol_scheduler,
'system',
'disk',
'usage',
15,
roles
)
roles = 'hq_api_servers'
time.sleep(3)
'''
register_scheduler_task(
axol_scheduler,
'hq',
'logs',
'error',
15,
roles
)
'''
# ----------------------------''
'''
roles = 'axol'
register_scheduler_task(
axol_scheduler,
'network',
'heartbeat',
'usage',
15,
roles
)
time.sleep(3)
register_scheduler_task(
axol_scheduler,
'system',
'memory',
'stats',
15,
roles
)
'''
print 'sleep 5'
time.sleep(3)
'''
roles = 'axol'
register_scheduler_task(
axol_scheduler,
'system',
'cpu',
'usage',
15,
roles
)
print 'sleep 5'
time.sleep(3)
register_scheduler_task(
axol_scheduler,
'system',
'disk',
'usage',
15,
roles
)
'''
roles = 'production_servers'
register_scheduler_task(
axol_scheduler,
'system',
'health',
'stats',
15,
roles
)
'''
roles = 'axol'
time.sleep(3)
register_scheduler_task(
axol_scheduler,
'system',
'health',
'stats',
15,
roles
)
'''
| 13.657895
| 81
| 0.539114
| 263
| 2,595
| 5.114068
| 0.239544
| 0.154647
| 0.202974
| 0.241636
| 0.779182
| 0.763569
| 0.733086
| 0.719703
| 0.640149
| 0.539777
| 0
| 0.020751
| 0.220039
| 2,595
| 189
| 82
| 13.730159
| 0.643775
| 0.158767
| 0
| 0.666667
| 0
| 0
| 0.247248
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.026667
| null | null | 0.053333
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a12ebf9831d3506279ed6bbd5df00b0828045311
| 21,795
|
py
|
Python
|
codes/rl/upbit_rl_policy.py
|
bluebibi/trade
|
32145c2a139f4172159ace8dfad11591ad8839ea
|
[
"MIT"
] | 2
|
2021-02-03T19:03:13.000Z
|
2021-03-06T15:58:08.000Z
|
codes/rl/upbit_rl_policy.py
|
bluebibi/trade
|
32145c2a139f4172159ace8dfad11591ad8839ea
|
[
"MIT"
] | 10
|
2020-01-28T23:09:34.000Z
|
2022-02-10T00:23:12.000Z
|
codes/rl/upbit_rl_policy.py
|
bluebibi/trade
|
32145c2a139f4172159ace8dfad11591ad8839ea
|
[
"MIT"
] | 1
|
2019-11-03T11:37:37.000Z
|
2019-11-03T11:37:37.000Z
|
import glob
import math
import warnings
import boto3
import numpy as np
from statsmodels.tools.sm_exceptions import ConvergenceWarning
from torch import optim
from codes.rl.upbit_rl_replay_buffer import PrioritizedReplayBuffer, ReplayBuffer
warnings.filterwarnings("ignore")
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=ConvergenceWarning)
import random
import sys, os
idx = os.getcwd().index("trade")
PROJECT_HOME = os.getcwd()[:idx] + "trade"
sys.path.append(PROJECT_HOME)
from codes.rl.upbit_rl_utils import BuyerAction, SellerAction
import torch.nn as nn
import torch
from codes.rl.upbit_rl_constants import GAMMA, LEARNING_RATE, TRAIN_BATCH_SIZE_PERCENT, TRAIN_REPEATS, \
BUYER_MODEL_SAVE_PATH, SELLER_MODEL_SAVE_PATH, BUYER_MODEL_FILE_NAME, S3_BUCKET_NAME, SELLER_MODEL_FILE_NAME, \
TRAIN_BATCH_MIN_SIZE, REPLAY_MEMORY_SIZE, SIZE_OF_FEATURE, SIZE_OF_FEATURE_WITHOUT_VOLUME, \
TRAIN_REPEATS_STEPS, TRAIN_BATCH_MIN_SIZE_STEPS, SIZE_OF_OHLCV_FEATURE, SIZE_OF_OHLCV_FEATURE_WITHOUT_VOLUME
is_cuda = torch.cuda.is_available()
if is_cuda:
device = torch.device("cuda")
print("GPU is available")
else:
device = torch.device("cpu")
print("GPU not available, CPU used")
s3 = boto3.client('s3')
class DeepBuyerPolicy:
def __init__(self, args=None, play=False):
self.args = args
self.play = play
if self.args.ohlc:
if self.args.volume:
self.input_size = SIZE_OF_OHLCV_FEATURE
else:
self.input_size = SIZE_OF_OHLCV_FEATURE_WITHOUT_VOLUME
else:
if self.args.volume:
self.input_size = SIZE_OF_FEATURE
else:
self.input_size = SIZE_OF_FEATURE_WITHOUT_VOLUME
if self.args.lstm:
if self.args.ohlc:
self.q = QNet_LSTM(input_size=self.input_size, hidden_size=[64, 24])
self.q_target = QNet_LSTM(input_size=self.input_size, hidden_size=[64, 24])
else:
self.q = QNet_LSTM(input_size=self.input_size, hidden_size=[256, 128])
self.q_target = QNet_LSTM(input_size=self.input_size, hidden_size=[256, 128])
else:
if self.args.ohlc:
self.q = QNet_CNN(
input_size=self.input_size, input_height=int(self.args.window_size), conv_kernel_size_list=[2, 2, 2]
)
self.q_target = QNet_CNN(
input_size=self.input_size, input_height=int(self.args.window_size), conv_kernel_size_list=[2, 2, 2]
)
else:
self.q = QNet_CNN(
input_size=self.input_size, input_height=int(self.args.window_size), conv_kernel_size_list=[3, 3, 3]
)
self.q_target = QNet_CNN(
input_size=self.input_size, input_height=int(self.args.window_size), conv_kernel_size_list=[3, 3, 3]
)
if self.play:
self.load_model()
if hasattr(self.args, "per") and self.args.per:
self.buyer_memory = PrioritizedReplayBuffer(capacity=REPLAY_MEMORY_SIZE)
else:
self.buyer_memory = ReplayBuffer(capacity=REPLAY_MEMORY_SIZE)
self.pending_buyer_transition = None
self.optimizer = optim.Adam(self.q.parameters(), lr=LEARNING_RATE)
def sample_action(self, observation, info_dic, epsilon):
action, from_model = self.q.sample_action(observation, epsilon)
if action: # 1
return BuyerAction.MARKET_BUY, from_model
else:
return BuyerAction.BUY_HOLD, from_model
def qnet_copy_to_target_qnet(self):
self.q_target.load_state_dict(self.q.state_dict())
def save_model(self, episode, max_total_balance_per_episode,
market_profitable_buys_from_model_rate,
market_profitable_sells_from_model_rate):
self.remove_model()
buyer_model_file_path = BUYER_MODEL_SAVE_PATH.format(
"LSTM" if self.args.lstm else "CNN",
self.args.coin,
int(self.args.window_size),
self.input_size,
"{0}_{1:3.2f}_{2:3.2f}_{3:3.2f}".format(
episode, max_total_balance_per_episode, market_profitable_buys_from_model_rate, market_profitable_sells_from_model_rate
)
)
torch.save(self.q.state_dict(), buyer_model_file_path)
# buyer_model_file_name = BUYER_MODEL_FILE_NAME.format(
# "LSTM" if self.args.lstm else "CNN",
# self.args.coin,
# int(self.args.window_size),
# self.input_size,
# episode
# )
# if self.args.federated:
# s3.upload_file(
# buyer_model_file_path,
# S3_BUCKET_NAME,
# "REINFORCEMENT_LEARNING/{0}".format(buyer_model_file_name)
# )
def remove_model(self):
buyer_model_file_path = BUYER_MODEL_SAVE_PATH.format(
"LSTM" if self.args.lstm else "CNN",
self.args.coin,
int(self.args.window_size),
self.input_size,
"*"
)
for name in glob.glob(buyer_model_file_path):
os.remove(name)
def load_model(self):
last_buyer_model_file_path = BUYER_MODEL_SAVE_PATH.format(
"LSTM" if self.args.lstm else "CNN",
self.args.coin,
int(self.args.window_size),
self.input_size,
"*"
)
# last_buyer_model_file_name = BUYER_MODEL_FILE_NAME.format(
# "LSTM" if self.args.lstm else "CNN",
# self.args.coin,
# int(self.args.window_size),
# self.input_size,
# "*"
# )
for name in glob.glob(last_buyer_model_file_path):
self.q.load_state_dict(torch.load(name))
print("LOADED BY EXISTING BUYER POLICY MODEL FROM LOCAL FILE: {0}!!!\n".format(
name
))
break
# if self.args.federated:
# s3.download_file(
# S3_BUCKET_NAME,
# "REINFORCEMENT_LEARNING/{0}".format(last_buyer_model_file_name),
# last_buyer_model_file_path
# )
# self.q.load_state_dict(torch.load(last_buyer_model_file_path))
# print("LOADED BY EXISTING BUYER POLICY MODEL FROM AWS S3!!!\n")
# else:
# if os.path.exists(last_buyer_model_file_path):
# self.q.load_state_dict(torch.load(last_buyer_model_file_path))
# print("LOADED BY EXISTING BUYER POLICY MODEL FROM LOCAL STORAGE!!!\n")
# else:
# print("THERE IS NO SAVED MODEL: {0}".format(last_buyer_model_file_path))
# exit(-1)
self.qnet_copy_to_target_qnet()
def train(self, beta):
loss_lst = []
if self.args.train_episode_ends:
train_repeats = TRAIN_REPEATS
train_batch_min_size = TRAIN_BATCH_MIN_SIZE
else:
train_repeats = TRAIN_REPEATS_STEPS
train_batch_min_size = TRAIN_BATCH_MIN_SIZE_STEPS
for i in range(train_repeats):
train_batch_size = min(
train_batch_min_size,
int(self.buyer_memory.size() * TRAIN_BATCH_SIZE_PERCENT / 100)
)
indices = weights = None
if hasattr(self.args, "per") and self.args.per:
s, a, r, s_prime, done_mask, indices, weights = self.buyer_memory.sample_priority_memory(
train_batch_size, beta=beta
)
else:
s, a, r, s_prime, done_mask = self.buyer_memory.sample_memory(train_batch_size)
q_out = self.q(s)
q_a = q_out.gather(1, a)
max_q_prime = self.q_target(s_prime).max(1)[0].unsqueeze(1).detach()
target = r + GAMMA * max_q_prime * done_mask
if hasattr(self.args, "per") and self.args.per:
q_a = torch.squeeze(q_a, dim=1)
target = torch.squeeze(target, dim=1)
loss = (q_a - target).pow(2) * weights
#loss = (target - q_a) * weights
prios = torch.abs(q_a - target) + 1e-5
loss = loss.mean()
loss_lst.append(loss.item())
self.buyer_memory.update_priorities(indices, prios.data.cpu().numpy())
else:
q_a = torch.squeeze(q_a, dim=1)
target = torch.squeeze(target, dim=1)
loss = (q_a - target).pow(2).mean()
loss_lst.append(loss.item())
self.optimizer.zero_grad()
loss.backward()
# for param in self.q.parameters():
# param.grad.data.clamp_(-1, 1)
self.optimizer.step()
avg_loss = np.average(loss_lst)
#print("*** Buyer Policy Trained (Loss: {0}) ***\n".format(avg_loss))
return avg_loss
def update_episode_reward(self, episode, episode_reward):
for transition in self.buyer_memory.buffer:
if transition[0] == episode:
transition[3] += episode_reward
class DeepSellerPolicy:
def __init__(self, args=None, play=False):
self.args = args
self.play = play
if self.args.ohlc:
if self.args.volume:
self.input_size = SIZE_OF_OHLCV_FEATURE
else:
self.input_size = SIZE_OF_OHLCV_FEATURE_WITHOUT_VOLUME
else:
if self.args.volume:
self.input_size = SIZE_OF_FEATURE
else:
self.input_size = SIZE_OF_FEATURE_WITHOUT_VOLUME
if self.args.lstm:
if self.args.ohlc:
self.q = QNet_LSTM(input_size=self.input_size, hidden_size=[64, 24])
self.q_target = QNet_LSTM(input_size=self.input_size, hidden_size=[64, 24])
else:
self.q = QNet_LSTM(input_size=self.input_size, hidden_size=[256, 128])
self.q_target = QNet_LSTM(input_size=self.input_size, hidden_size=[256, 128])
else:
if self.args.ohlc:
self.q = QNet_CNN(
input_size=self.input_size, input_height=int(self.args.window_size), conv_kernel_size_list=[2, 2, 2]
)
self.q_target = QNet_CNN(
input_size=self.input_size, input_height=int(self.args.window_size), conv_kernel_size_list=[2, 2, 2]
)
else:
self.q = QNet_CNN(
input_size=self.input_size, input_height=int(self.args.window_size), conv_kernel_size_list=[3, 3, 3]
)
self.q_target = QNet_CNN(
input_size=self.input_size, input_height=int(self.args.window_size), conv_kernel_size_list=[3, 3, 3]
)
if self.play:
self.load_model()
if hasattr(self.args, "per") and self.args.per:
self.seller_memory = PrioritizedReplayBuffer(capacity=REPLAY_MEMORY_SIZE)
else:
self.seller_memory = ReplayBuffer(capacity=REPLAY_MEMORY_SIZE)
self.optimizer = optim.Adam(self.q.parameters(), lr=LEARNING_RATE)
def sample_action(self, observation, info_dic, epsilon):
action, from_model = self.q.sample_action(observation, epsilon)
if action: # 1
return SellerAction.MARKET_SELL, from_model
else:
return SellerAction.SELL_HOLD, from_model
def qnet_copy_to_target_qnet(self):
self.q_target.load_state_dict(self.q.state_dict())
def save_model(self, episode, max_total_balance_per_episode,
market_profitable_buys_from_model_rate,
market_profitable_sells_from_model_rate):
self.remove_model()
seller_model_file_path = SELLER_MODEL_SAVE_PATH.format(
"LSTM" if self.args.lstm else "CNN",
self.args.coin,
int(self.args.window_size),
self.input_size,
"{0}_{1:3.2f}_{2:3.2f}_{3:3.2f}".format(
episode, max_total_balance_per_episode, market_profitable_buys_from_model_rate, market_profitable_sells_from_model_rate
)
)
torch.save(self.q.state_dict(), seller_model_file_path)
# seller_model_file_name = SELLER_MODEL_FILE_NAME.format(
# "LSTM" if self.args.lstm else "CNN",
# self.args.coin,
# int(self.args.window_size),
# SIZE_OF_FEATURE if self.args.volume else SIZE_OF_FEATURE_WITHOUT_VOLUME,
# episode
# )
# if self.args.federated:
# s3.upload_file(
# seller_model_file_path,
# S3_BUCKET_NAME,
# "REINFORCEMENT_LEARNING/{0}".format(seller_model_file_name)
# )
def remove_model(self):
seller_model_file_path = SELLER_MODEL_SAVE_PATH.format(
"LSTM" if self.args.lstm else "CNN",
self.args.coin,
int(self.args.window_size),
self.input_size,
"*"
)
for name in glob.glob(seller_model_file_path):
os.remove(name)
def load_model(self):
last_seller_model_file_path = SELLER_MODEL_SAVE_PATH.format(
"LSTM" if self.args.lstm else "CNN",
self.args.coin,
int(self.args.window_size),
self.input_size,
"*"
)
# last_seller_model_file_name = SELLER_MODEL_FILE_NAME.format(
# "LSTM" if self.args.lstm else "CNN",
# self.args.coin,
# int(self.args.window_size),
# self.input_size,
# "*"
# )
for name in glob.glob(last_seller_model_file_path):
self.q.load_state_dict(torch.load(name))
print("LOADED BY EXISTING SELLER POLICY MODEL FROM LOCAL FILE: {0}!!!\n".format(
name
))
break
# if self.args.federated:
# s3.download_file(
# S3_BUCKET_NAME,
# "REINFORCEMENT_LEARNING/{0}".format(last_seller_model_file_name),
# last_seller_model_file_path
# )
# self.q.load_state_dict(torch.load(last_seller_model_file_path))
# print("LOADED BY EXISTING SELLER POLICY MODEL FROM AWS S3!!!\n")
# else:
# if os.path.exists(last_seller_model_file_path):
# self.q.load_state_dict(torch.load(last_seller_model_file_path))
# print("LOADED BY EXISTING SELLER POLICY MODEL FROM LOCAL STORAGE!!!\n")
# else:
# print("THERE IS NO SAVED MODEL: {0}".format(last_seller_model_file_path))
# exit(-1)
self.qnet_copy_to_target_qnet()
def train(self, beta):
loss_lst = []
if self.args.train_episode_ends:
train_repeats = TRAIN_REPEATS
train_batch_min_size = TRAIN_BATCH_MIN_SIZE
else:
train_repeats = TRAIN_REPEATS_STEPS
train_batch_min_size = TRAIN_BATCH_MIN_SIZE_STEPS
for i in range(train_repeats):
train_batch_size = min(
train_batch_min_size,
int(self.seller_memory.size() * TRAIN_BATCH_SIZE_PERCENT / 100)
)
indices = weights = None
if hasattr(self.args, "per") and self.args.per:
s, a, r, s_prime, done_mask, indices, weights = self.seller_memory.sample_priority_memory(
train_batch_size, beta=beta
)
else:
s, a, r, s_prime, done_mask = self.seller_memory.sample_memory(train_batch_size)
q_out = self.q(s)
q_a = q_out.gather(1, a)
max_q_prime = self.q_target(s_prime).max(1)[0].unsqueeze(1).detach()
target = r + GAMMA * max_q_prime * done_mask
if hasattr(self.args, "per") and self.args.per:
q_a = torch.squeeze(q_a, dim=1)
target = torch.squeeze(target, dim=1)
loss = (target - q_a).pow(2) * weights
#loss = (target - q_a) * weights
prios = torch.abs(q_a - target) + 1e-5
loss = loss.mean()
loss_lst.append(loss.item())
self.seller_memory.update_priorities(indices, prios.data.cpu().numpy())
else:
q_a = torch.squeeze(q_a, dim=1)
target = torch.squeeze(target, dim=1)
loss = (q_a - target).pow(2).mean()
loss_lst.append(loss.item())
self.optimizer.zero_grad()
loss.backward()
# for param in self.q.parameters():
# param.grad.data.clamp_(-1, 1)
self.optimizer.step()
avg_loss = np.average(loss_lst)
#print("*** Seller Policy Trained (Loss: {0}) ***\n".format(avg_loss))
return avg_loss
def update_episode_reward(self, episode, episode_reward):
for transition in self.seller_memory.buffer:
if transition[0] == episode:
transition[3] += episode_reward
class QNet_CNN(nn.Module):
@staticmethod
def get_conv2d_size(w, h, kernel_size, padding_size, stride):
return math.floor((w - kernel_size + 2 * padding_size) / stride) + 1, math.floor(
(h - kernel_size + 2 * padding_size) / stride) + 1
@staticmethod
def get_pool2d_size(w, h, kernel_size, stride):
return math.floor((w - kernel_size) / stride) + 1, math.floor((h - kernel_size) / stride) + 1
def __init__(self, input_height, input_size, output_size=2, conv_kernel_size_list=[2, 2, 2]): #input_size=36, input_height=21
super(QNet_CNN, self).__init__()
self.output_size = output_size
self.layer = nn.Sequential(
nn.Conv2d(in_channels=1, out_channels=2, kernel_size=conv_kernel_size_list[0]), # [batch_size,1,28,28] -> [batch_size,16,24,24]
nn.BatchNorm2d(num_features=2),
nn.LeakyReLU(),
nn.Conv2d(in_channels=2, out_channels=4, kernel_size=conv_kernel_size_list[1]), # [batch_size,16,24,24] -> [batch_size,32,20,20]
nn.BatchNorm2d(num_features=4),
nn.LeakyReLU(),
nn.MaxPool2d(kernel_size=2, stride=1), # [batch_size,32,20,20] -> [batch_size,32,10,10]
nn.Conv2d(in_channels=4, out_channels=6, kernel_size=conv_kernel_size_list[2]), # [batch_size,32,10,10] -> [batch_size,64,6,6]
nn.BatchNorm2d(num_features=6),
nn.LeakyReLU(),
nn.MaxPool2d(kernel_size=2, stride=1) # [batch_size,64,6,6] -> [batch_size,64,3,3]
)
w, h = self.get_conv2d_size(w=input_size, h=input_height, kernel_size=conv_kernel_size_list[0], padding_size=0, stride=1)
w, h = self.get_conv2d_size(w=w, h=h, kernel_size=conv_kernel_size_list[1], padding_size=0, stride=1)
w, h = self.get_pool2d_size(w=w, h=h, kernel_size=2, stride=1)
w, h = self.get_conv2d_size(w=w, h=h, kernel_size=conv_kernel_size_list[2], padding_size=0, stride=1)
w, h = self.get_pool2d_size(w=w, h=h, kernel_size=2, stride=1)
self.fc_layer = nn.Sequential(
nn.Linear(w * h * 6, 128),
nn.LeakyReLU(),
nn.Linear(128, 32),
nn.LeakyReLU(),
nn.Linear(32, self.output_size)
)
def forward(self, x):
x = x.unsqueeze(dim=1)
out = self.layer(x)
out = out.view(x.size(0), -1)
out = self.fc_layer(out)
return out.squeeze(dim=1)
def sample_action(self, x, epsilon):
coin = random.random()
if coin < epsilon:
from_model = 0
return random.randint(0, 1), from_model
else:
from_model = 1
if not isinstance(x, torch.Tensor):
x = torch.unsqueeze(torch.Tensor(x), dim=0)
out = self.forward(x)
return out.argmax().item(), from_model
class QNet_LSTM(nn.Module):
def __init__(self, input_size, hidden_size=[256, 128], output_size=2, num_layers=3, bias=True):
super(QNet_LSTM, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size[0]
self.output_size = output_size
self.num_layers = num_layers
self.lstm = nn.LSTM(
input_size=self.input_size,
hidden_size=self.hidden_size,
num_layers=self.num_layers,
batch_first=True,
bias=bias
)
self.fc_layer = nn.Sequential(
nn.Linear(self.hidden_size, hidden_size[1]),
nn.LeakyReLU(),
nn.Linear(hidden_size[1], self.output_size)
)
def forward(self, x):
batch_size = x.size(0)
hidden = self.init_hidden(batch_size)
out, _ = self.lstm(x, hidden)
out = out[:, -1, :]
out = self.fc_layer(out)
out = torch.sigmoid(out)
return out
def init_hidden(self, batch_size):
return (torch.zeros(self.num_layers, batch_size, self.hidden_size),
torch.zeros(self.num_layers, batch_size, self.hidden_size))
def sample_action(self, x, epsilon):
coin = random.random()
if coin < epsilon:
from_model = 0
return random.randint(0, 1), from_model
else:
from_model = 1
if not isinstance(x, torch.Tensor):
x = torch.unsqueeze(torch.Tensor(x), dim=0)
out = self.forward(x)
return out.argmax().item(), from_model
| 38.304042
| 141
| 0.588254
| 2,816
| 21,795
| 4.253906
| 0.091264
| 0.048752
| 0.039068
| 0.036898
| 0.837799
| 0.807997
| 0.791301
| 0.747976
| 0.717589
| 0.715669
| 0
| 0.019889
| 0.307915
| 21,795
| 569
| 142
| 38.304042
| 0.774264
| 0.138013
| 0
| 0.655779
| 0
| 0.005025
| 0.017379
| 0.003208
| 0
| 0
| 0
| 0
| 0
| 1
| 0.062814
| false
| 0
| 0.035176
| 0.007538
| 0.145729
| 0.01005
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a15d4813ac1b6a85f28515a6b070a4cde6c5e700
| 81
|
py
|
Python
|
pty/__init__.py
|
dxm447/ptychogpu
|
337d136b1b738ddbc3241144e49fa0129b7bcac1
|
[
"MIT"
] | 1
|
2021-09-14T01:28:43.000Z
|
2021-09-14T01:28:43.000Z
|
pty/__init__.py
|
Rydeness/ptychogpu
|
337d136b1b738ddbc3241144e49fa0129b7bcac1
|
[
"MIT"
] | null | null | null |
pty/__init__.py
|
Rydeness/ptychogpu
|
337d136b1b738ddbc3241144e49fa0129b7bcac1
|
[
"MIT"
] | 2
|
2021-09-14T01:28:42.000Z
|
2021-09-16T00:08:59.000Z
|
from .pie import *
from .wdd import *
from .ssb import *
from .pty_utils import *
| 20.25
| 24
| 0.716049
| 13
| 81
| 4.384615
| 0.538462
| 0.526316
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.185185
| 81
| 4
| 24
| 20.25
| 0.863636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
a19045bf7d2e19f25e0626258925a3ac4297e7d1
| 125
|
py
|
Python
|
info/moduels/user/__init__.py
|
haczfdx/information
|
7364fb6eea54bb1d17b70c626cdceda129f99902
|
[
"MIT"
] | null | null | null |
info/moduels/user/__init__.py
|
haczfdx/information
|
7364fb6eea54bb1d17b70c626cdceda129f99902
|
[
"MIT"
] | null | null | null |
info/moduels/user/__init__.py
|
haczfdx/information
|
7364fb6eea54bb1d17b70c626cdceda129f99902
|
[
"MIT"
] | null | null | null |
"""这个蓝图对应的是登录注册相关的操作"""
from flask import Blueprint
user_blue = Blueprint('user', __name__)
import info.moduels.user.views
| 17.857143
| 39
| 0.776
| 15
| 125
| 6.133333
| 0.733333
| 0.282609
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.104
| 125
| 6
| 40
| 20.833333
| 0.821429
| 0.136
| 0
| 0
| 0
| 0
| 0.039216
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0.666667
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
|
0
| 6
|
a197006904377108462430660c440d0dc3911b28
| 74
|
py
|
Python
|
survae/tests/nn/nets/__init__.py
|
alisiahkoohi/survae_flows
|
e1747b05524c7ab540a211ed360ab3e67bc3e96d
|
[
"MIT"
] | 262
|
2020-07-05T20:57:44.000Z
|
2022-03-28T02:24:43.000Z
|
survae/tests/nn/nets/__init__.py
|
alisiahkoohi/survae_flows
|
e1747b05524c7ab540a211ed360ab3e67bc3e96d
|
[
"MIT"
] | 17
|
2020-08-15T05:43:34.000Z
|
2022-01-31T12:24:21.000Z
|
survae/tests/nn/nets/__init__.py
|
alisiahkoohi/survae_flows
|
e1747b05524c7ab540a211ed360ab3e67bc3e96d
|
[
"MIT"
] | 35
|
2020-08-24T06:55:37.000Z
|
2022-02-11T05:17:58.000Z
|
from .mlp import *
from .autoregressive import *
from .matching import *
| 14.8
| 29
| 0.743243
| 9
| 74
| 6.111111
| 0.555556
| 0.363636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.175676
| 74
| 4
| 30
| 18.5
| 0.901639
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
a1b902e0a936293db8d03d8edefb592700f709b0
| 19
|
py
|
Python
|
labot/__init__.py
|
hyperfraise/LaBot
|
1150067a28aa0f2d4465270b1f84248facc09e91
|
[
"MIT"
] | 47
|
2018-04-10T12:03:48.000Z
|
2022-02-09T14:55:08.000Z
|
labot/__init__.py
|
hyperfraise/LaBot
|
1150067a28aa0f2d4465270b1f84248facc09e91
|
[
"MIT"
] | 23
|
2018-05-12T21:55:26.000Z
|
2021-12-30T09:03:48.000Z
|
labot/__init__.py
|
hyperfraise/LaBot
|
1150067a28aa0f2d4465270b1f84248facc09e91
|
[
"MIT"
] | 31
|
2018-05-01T18:33:42.000Z
|
2022-02-04T03:55:34.000Z
|
from . import logs
| 9.5
| 18
| 0.736842
| 3
| 19
| 4.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.210526
| 19
| 1
| 19
| 19
| 0.933333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
b810a3dd2e550f8a10df8cfd23c0fa2343ccb54c
| 201
|
py
|
Python
|
tatter/tests/__init__.py
|
afarahi/tatter
|
e206b761baec0deb79ddc692a25bfd063f8d5ce1
|
[
"MIT"
] | 2
|
2020-03-13T23:24:00.000Z
|
2021-09-12T16:41:53.000Z
|
tatter/tests/__init__.py
|
afarahi/tatter
|
e206b761baec0deb79ddc692a25bfd063f8d5ce1
|
[
"MIT"
] | 2
|
2021-06-17T01:37:10.000Z
|
2021-06-17T01:56:22.000Z
|
tatter/tests/__init__.py
|
afarahi/tatter
|
e206b761baec0deb79ddc692a25bfd063f8d5ce1
|
[
"MIT"
] | null | null | null |
from gaussian_vs_lognormal import test_gaussian_vs_lognormal
from cluster_catalog_comp import RM_clusters_consistency_check, RM_clusters_witness_function
from mnist_test import mnist_digits_distance
| 33.5
| 92
| 0.920398
| 29
| 201
| 5.827586
| 0.62069
| 0.118343
| 0.224852
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074627
| 201
| 6
| 93
| 33.5
| 0.908602
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
a7f39a24a4de48a99b2e55aecd516edb8bc51c7c
| 139
|
py
|
Python
|
sneruz/__init__.py
|
Sn00pbom/sneruz
|
1bc1eb2986d419e43a258d9e19cb80c57e618b52
|
[
"MIT"
] | null | null | null |
sneruz/__init__.py
|
Sn00pbom/sneruz
|
1bc1eb2986d419e43a258d9e19cb80c57e618b52
|
[
"MIT"
] | null | null | null |
sneruz/__init__.py
|
Sn00pbom/sneruz
|
1bc1eb2986d419e43a258d9e19cb80c57e618b52
|
[
"MIT"
] | null | null | null |
from sneruz.prop import Prop
from sneruz.domain import Domain
from sneruz.util.truthtable import TruthTable
from sneruz.proof import Proof
| 27.8
| 45
| 0.848921
| 21
| 139
| 5.619048
| 0.380952
| 0.338983
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115108
| 139
| 4
| 46
| 34.75
| 0.95935
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
c503596b830cdb9b9524b61a0a691a6ad5711585
| 70
|
py
|
Python
|
utils/Generator.py
|
Zigars/Yolov4-Pytorch
|
4f4291df2d43f97884345a154eb20191cef6f49f
|
[
"MIT"
] | 1
|
2021-07-06T13:18:41.000Z
|
2021-07-06T13:18:41.000Z
|
utils/Generator.py
|
Zigars/Yolov4-Pytorch
|
4f4291df2d43f97884345a154eb20191cef6f49f
|
[
"MIT"
] | null | null | null |
utils/Generator.py
|
Zigars/Yolov4-Pytorch
|
4f4291df2d43f97884345a154eb20191cef6f49f
|
[
"MIT"
] | null | null | null |
'''
TODO
@Description:数据增强
@Author:Zigar
@Date:2021/03/29 09:09:45
'''
| 11.666667
| 25
| 0.685714
| 12
| 70
| 4
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.21875
| 0.085714
| 70
| 6
| 26
| 11.666667
| 0.53125
| 0.885714
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0.166667
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
c503b8505a013e55b9c96da7f3ba0e21600c114d
| 108
|
py
|
Python
|
core/exceptions.py
|
danmcelroy/VoSeq
|
e22bd5d971154170bf3f4f24b684b95a12418637
|
[
"BSD-3-Clause"
] | 2
|
2019-08-20T04:16:12.000Z
|
2020-08-25T02:05:12.000Z
|
core/exceptions.py
|
danmcelroy/VoSeq
|
e22bd5d971154170bf3f4f24b684b95a12418637
|
[
"BSD-3-Clause"
] | 65
|
2016-09-27T23:14:51.000Z
|
2022-03-19T14:17:58.000Z
|
core/exceptions.py
|
danmcelroy/VoSeq
|
e22bd5d971154170bf3f4f24b684b95a12418637
|
[
"BSD-3-Clause"
] | 4
|
2018-07-02T16:57:44.000Z
|
2021-03-23T02:12:15.000Z
|
class MissingReadingFrameForGene(Exception):
pass
class InadequateCodonPositions(Exception):
pass
| 15.428571
| 44
| 0.796296
| 8
| 108
| 10.75
| 0.625
| 0.302326
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.148148
| 108
| 6
| 45
| 18
| 0.934783
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 6
|
c50d2229a01918af2fef1df99ae4178607c10493
| 123,181
|
py
|
Python
|
tests/v2/test_0914-types-and-forms.py
|
scikit-hep/awkward-1.0
|
a440328f8097d22c2ba053fd117fed543829afc0
|
[
"BSD-3-Clause"
] | 519
|
2019-10-17T12:36:22.000Z
|
2022-03-26T23:28:19.000Z
|
tests/v2/test_0914-types-and-forms.py
|
scikit-hep/awkward-1.0
|
a440328f8097d22c2ba053fd117fed543829afc0
|
[
"BSD-3-Clause"
] | 924
|
2019-11-03T21:05:01.000Z
|
2022-03-31T22:44:30.000Z
|
tests/v2/test_0914-types-and-forms.py
|
scikit-hep/awkward-1.0
|
a440328f8097d22c2ba053fd117fed543829afc0
|
[
"BSD-3-Clause"
] | 56
|
2019-12-17T15:49:22.000Z
|
2022-03-09T20:34:06.000Z
|
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
pytestmark = pytest.mark.skipif(
ak._util.py27, reason="No Python 2.7 support in Awkward 2.x"
)
def test_UnknownType():
assert str(ak._v2.types.unknowntype.UnknownType()) == "unknown"
assert (
str(ak._v2.types.unknowntype.UnknownType({"x": 123}))
== 'unknown[parameters={"x": 123}]'
)
assert str(ak._v2.types.unknowntype.UnknownType(None, "override")) == "override"
assert (
str(ak._v2.types.unknowntype.UnknownType({"x": 123}, "override")) == "override"
)
assert (
str(ak._v2.types.unknowntype.UnknownType({"__categorical__": True}))
== "categorical[type=unknown]"
)
assert (
str(ak._v2.types.unknowntype.UnknownType({"__categorical__": True, "x": 123}))
== 'categorical[type=unknown[parameters={"x": 123}]]'
)
assert (
str(ak._v2.types.unknowntype.UnknownType({"__categorical__": True}, "override"))
== "categorical[type=override]"
)
assert repr(ak._v2.types.unknowntype.UnknownType()) == "UnknownType()"
assert (
repr(
ak._v2.types.unknowntype.UnknownType(
parameters={"__categorical__": True}, typestr="override"
)
)
== "UnknownType(parameters={'__categorical__': True}, typestr='override')"
)
@pytest.mark.skipif(
ak._util.win,
reason="NumPy does not have float16, float128, and complex256 -- on Windows",
)
def test_NumpyType():
assert str(ak._v2.types.numpytype.NumpyType("bool")) == "bool"
assert str(ak._v2.types.numpytype.NumpyType("int8")) == "int8"
assert str(ak._v2.types.numpytype.NumpyType("uint8")) == "uint8"
assert str(ak._v2.types.numpytype.NumpyType("int16")) == "int16"
assert str(ak._v2.types.numpytype.NumpyType("uint16")) == "uint16"
assert str(ak._v2.types.numpytype.NumpyType("int32")) == "int32"
assert str(ak._v2.types.numpytype.NumpyType("uint32")) == "uint32"
assert str(ak._v2.types.numpytype.NumpyType("int64")) == "int64"
assert str(ak._v2.types.numpytype.NumpyType("uint64")) == "uint64"
assert str(ak._v2.types.numpytype.NumpyType("float16")) == "float16"
assert str(ak._v2.types.numpytype.NumpyType("float32")) == "float32"
assert str(ak._v2.types.numpytype.NumpyType("float64")) == "float64"
assert str(ak._v2.types.numpytype.NumpyType("float128")) == "float128"
assert str(ak._v2.types.numpytype.NumpyType("complex64")) == "complex64"
assert str(ak._v2.types.numpytype.NumpyType("complex128")) == "complex128"
assert str(ak._v2.types.numpytype.NumpyType("complex256")) == "complex256"
assert (
str(ak._v2.types.numpytype.NumpyType("bool", {"x": 123}))
== 'bool[parameters={"x": 123}]'
)
assert str(ak._v2.types.numpytype.NumpyType("bool", None, "override")) == "override"
assert (
str(ak._v2.types.numpytype.NumpyType("bool", {"x": 123}, "override"))
== "override"
)
assert (
str(ak._v2.types.numpytype.NumpyType("bool", {"__categorical__": True}))
== "categorical[type=bool]"
)
assert (
str(
ak._v2.types.numpytype.NumpyType(
"bool", {"__categorical__": True, "x": 123}
)
)
== 'categorical[type=bool[parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.numpytype.NumpyType(
"bool", {"__categorical__": True}, "override"
)
)
== "categorical[type=override]"
)
assert str(ak._v2.types.numpytype.NumpyType("datetime64")) == "datetime64"
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "Y"}))
== 'datetime64[unit="Y"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "M"}))
== 'datetime64[unit="M"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "W"}))
== 'datetime64[unit="W"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "D"}))
== 'datetime64[unit="D"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "h"}))
== 'datetime64[unit="h"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "m"}))
== 'datetime64[unit="m"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "s"}))
== 'datetime64[unit="s"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "ms"}))
== 'datetime64[unit="ms"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "us"}))
== 'datetime64[unit="us"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "ns"}))
== 'datetime64[unit="ns"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "ps"}))
== 'datetime64[unit="ps"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "fs"}))
== 'datetime64[unit="fs"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "as"}))
== 'datetime64[unit="as"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "10s"}))
== 'datetime64[unit="10s"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "1s"}))
== 'datetime64[unit="s"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"__unit__": "s", "x": 123}))
== 'datetime64[unit="s", parameters={"x": 123}]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("datetime64", {"x": 123}))
== 'datetime64[parameters={"x": 123}]'
)
assert str(ak._v2.types.numpytype.NumpyType("timedelta64")) == "timedelta64"
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "Y"}))
== 'timedelta64[unit="Y"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "M"}))
== 'timedelta64[unit="M"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "W"}))
== 'timedelta64[unit="W"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "D"}))
== 'timedelta64[unit="D"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "h"}))
== 'timedelta64[unit="h"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "m"}))
== 'timedelta64[unit="m"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "s"}))
== 'timedelta64[unit="s"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "ms"}))
== 'timedelta64[unit="ms"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "us"}))
== 'timedelta64[unit="us"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "ns"}))
== 'timedelta64[unit="ns"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "ps"}))
== 'timedelta64[unit="ps"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "fs"}))
== 'timedelta64[unit="fs"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "as"}))
== 'timedelta64[unit="as"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "10s"}))
== 'timedelta64[unit="10s"]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "1s"}))
== 'timedelta64[unit="s"]'
)
assert (
str(
ak._v2.types.numpytype.NumpyType("timedelta64", {"__unit__": "s", "x": 123})
)
== 'timedelta64[unit="s", parameters={"x": 123}]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("timedelta64", {"x": 123}))
== 'timedelta64[parameters={"x": 123}]'
)
assert (
str(ak._v2.types.numpytype.NumpyType("uint8", {"__array__": "char"})) == "char"
)
assert (
str(ak._v2.types.numpytype.NumpyType("uint8", {"__array__": "byte"})) == "byte"
)
assert (
repr(ak._v2.types.numpytype.NumpyType(primitive="bool")) == "NumpyType('bool')"
)
assert (
repr(
ak._v2.types.numpytype.NumpyType(
primitive="bool",
parameters={"__categorical__": True},
typestr="override",
)
)
== "NumpyType('bool', parameters={'__categorical__': True}, typestr='override')"
)
assert (
repr(
ak._v2.types.numpytype.NumpyType(
primitive="datetime64", parameters={"__unit__": "s"}
)
)
== "NumpyType('datetime64', parameters={'__unit__': 's'})"
)
assert (
repr(
ak._v2.types.numpytype.NumpyType(
primitive="uint8", parameters={"__array__": "char"}
)
)
== "NumpyType('uint8', parameters={'__array__': 'char'})"
)
assert (
repr(
ak._v2.types.numpytype.NumpyType(
primitive="uint8", parameters={"__array__": "byte"}
)
)
== "NumpyType('uint8', parameters={'__array__': 'byte'})"
)
def test_RegularType():
assert (
str(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10
)
)
== "10 * unknown"
)
assert (
str(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 0
)
)
== "0 * unknown"
)
with pytest.raises(ValueError):
ak._v2.types.regulartype.RegularType(ak._v2.types.unknowntype.UnknownType(), -1)
assert (
str(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10, {"x": 123}
)
)
== '[10 * unknown, parameters={"x": 123}]'
)
assert (
str(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10, None, "override"
)
)
== "override"
)
assert (
str(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10, {"x": 123}, "override"
)
)
== "override"
)
assert (
str(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10, {"__categorical__": True}
)
)
== "categorical[type=10 * unknown]"
)
assert (
str(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(),
10,
{"__categorical__": True, "x": 123},
)
)
== 'categorical[type=[10 * unknown, parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(),
10,
{"__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.regulartype.RegularType(
ak._v2.types.numpytype.NumpyType("uint8", {"__array__": "char"}),
10,
{"__array__": "string"},
)
)
== "string[10]"
)
assert (
str(
ak._v2.types.regulartype.RegularType(
ak._v2.types.numpytype.NumpyType("uint8", {"__array__": "byte"}),
10,
{"__array__": "bytestring"},
)
)
== "bytes[10]"
)
assert (
repr(
ak._v2.types.regulartype.RegularType(
content=ak._v2.types.unknowntype.UnknownType(), size=10
)
)
== "RegularType(UnknownType(), 10)"
)
assert (
repr(
ak._v2.types.regulartype.RegularType(
content=ak._v2.types.unknowntype.UnknownType(),
size=10,
parameters={"__categorical__": True},
typestr="override",
)
)
== "RegularType(UnknownType(), 10, parameters={'__categorical__': True}, typestr='override')"
)
assert (
repr(
ak._v2.types.regulartype.RegularType(
content=ak._v2.types.numpytype.NumpyType(
primitive="uint8", parameters={"__array__": "char"}
),
parameters={"__array__": "string"},
size=10,
)
)
== "RegularType(NumpyType('uint8', parameters={'__array__': 'char'}), 10, parameters={'__array__': 'string'})"
)
assert (
repr(
ak._v2.types.regulartype.RegularType(
content=ak._v2.types.numpytype.NumpyType(
primitive="uint8", parameters={"__array__": "byte"}
),
parameters={"__array__": "bytestring"},
size=10,
)
)
== "RegularType(NumpyType('uint8', parameters={'__array__': 'byte'}), 10, parameters={'__array__': 'bytestring'})"
)
def test_ListType():
assert (
str(ak._v2.types.listtype.ListType(ak._v2.types.unknowntype.UnknownType()))
== "var * unknown"
)
assert (
str(
ak._v2.types.listtype.ListType(
ak._v2.types.unknowntype.UnknownType(), {"x": 123}
)
)
== '[var * unknown, parameters={"x": 123}]'
)
assert (
str(
ak._v2.types.listtype.ListType(
ak._v2.types.unknowntype.UnknownType(), None, "override"
)
)
== "override"
)
assert (
str(
ak._v2.types.listtype.ListType(
ak._v2.types.unknowntype.UnknownType(), {"x": 123}, "override"
)
)
== "override"
)
assert (
str(
ak._v2.types.listtype.ListType(
ak._v2.types.unknowntype.UnknownType(), {"__categorical__": True}
)
)
== "categorical[type=var * unknown]"
)
assert (
str(
ak._v2.types.listtype.ListType(
ak._v2.types.unknowntype.UnknownType(),
{"__categorical__": True, "x": 123},
)
)
== 'categorical[type=[var * unknown, parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.listtype.ListType(
ak._v2.types.unknowntype.UnknownType(),
{"__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.listtype.ListType(
ak._v2.types.numpytype.NumpyType("uint8", {"__array__": "char"}),
{"__array__": "string"},
)
)
== "string"
)
assert (
str(
ak._v2.types.listtype.ListType(
ak._v2.types.numpytype.NumpyType("uint8", {"__array__": "byte"}),
{"__array__": "bytestring"},
)
)
== "bytes"
)
assert (
repr(
ak._v2.types.listtype.ListType(
content=ak._v2.types.unknowntype.UnknownType()
)
)
== "ListType(UnknownType())"
)
assert (
repr(
ak._v2.types.listtype.ListType(
content=ak._v2.types.unknowntype.UnknownType(),
parameters={"__categorical__": True},
typestr="override",
)
)
== "ListType(UnknownType(), parameters={'__categorical__': True}, typestr='override')"
)
assert (
repr(
ak._v2.types.listtype.ListType(
content=ak._v2.types.numpytype.NumpyType(
primitive="uint8", parameters={"__array__": "char"}
),
parameters={"__array__": "string"},
)
)
== "ListType(NumpyType('uint8', parameters={'__array__': 'char'}), parameters={'__array__': 'string'})"
)
assert (
repr(
ak._v2.types.listtype.ListType(
content=ak._v2.types.numpytype.NumpyType(
primitive="uint8", parameters={"__array__": "byte"}
),
parameters={"__array__": "bytestring"},
)
)
== "ListType(NumpyType('uint8', parameters={'__array__': 'byte'}), parameters={'__array__': 'bytestring'})"
)
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_RecordType():
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
)
)
== "(unknown, bool)"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
)
)
== "{x: unknown, y: bool}"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"__record__": "Name"},
)
)
== "Name[unknown, bool]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"__record__": "Name"},
)
)
== "Name[x: unknown, y: bool]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
None,
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
None,
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"__record__": "Name"},
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"__record__": "Name"},
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"x": 123},
)
)
== 'tuple[[unknown, bool], parameters={"x": 123}]'
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"x": 123},
)
)
== 'struct[["x", "y"], [unknown, bool], parameters={"x": 123}]'
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"__record__": "Name", "x": 123},
)
)
== 'Name[unknown, bool, parameters={"x": 123}]'
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"__record__": "Name", "x": 123},
)
)
== 'Name[x: unknown, y: bool, parameters={"x": 123}]'
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"x": 123},
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"x": 123},
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"__record__": "Name", "x": 123},
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"__record__": "Name", "x": 123},
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"__categorical__": True},
)
)
== "categorical[type=(unknown, bool)]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"__categorical__": True},
)
)
== "categorical[type={x: unknown, y: bool}]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"__record__": "Name", "__categorical__": True},
)
)
== "categorical[type=Name[unknown, bool]]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"__record__": "Name", "__categorical__": True},
)
)
== "categorical[type=Name[x: unknown, y: bool]]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"__record__": "Name", "__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"__record__": "Name", "__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"x": 123, "__categorical__": True},
)
)
== 'categorical[type=tuple[[unknown, bool], parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"x": 123, "__categorical__": True},
)
)
== 'categorical[type=struct[["x", "y"], [unknown, bool], parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"__record__": "Name", "x": 123, "__categorical__": True},
)
)
== 'categorical[type=Name[unknown, bool, parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"__record__": "Name", "x": 123, "__categorical__": True},
)
)
== 'categorical[type=Name[x: unknown, y: bool, parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"x": 123, "__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"x": 123, "__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
{"__record__": "Name", "x": 123, "__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.recordtype.RecordType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
["x", "y"],
{"__record__": "Name", "x": 123, "__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
repr(
ak._v2.types.recordtype.RecordType(
contents=[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
keys=None,
)
)
== "RecordType([UnknownType(), NumpyType('bool')], None)"
)
assert (
repr(
ak._v2.types.recordtype.RecordType(
contents=[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
keys=["x", "y"],
)
)
== "RecordType([UnknownType(), NumpyType('bool')], ['x', 'y'])"
)
assert (
repr(
ak._v2.types.recordtype.RecordType(
contents=[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
keys=None,
parameters={"__record__": "Name", "x": 123, "__categorical__": True},
typestr="override",
)
)
== "RecordType([UnknownType(), NumpyType('bool')], None, parameters={'__record__': 'Name', 'x': 123, '__categorical__': True}, typestr='override')"
)
assert (
repr(
ak._v2.types.recordtype.RecordType(
contents=[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
keys=None,
parameters={"__record__": "Name", "x": 123, "__categorical__": True},
)
)
== "RecordType([UnknownType(), NumpyType('bool')], None, parameters={'__record__': 'Name', 'x': 123, '__categorical__': True})"
)
assert (
repr(
ak._v2.types.recordtype.RecordType(
contents=[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
keys=["x", "y"],
parameters={"__record__": "Name", "x": 123, "__categorical__": True},
typestr="override",
)
)
== "RecordType([UnknownType(), NumpyType('bool')], ['x', 'y'], parameters={'__record__': 'Name', 'x': 123, '__categorical__': True}, typestr='override')"
)
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_OptionType():
assert (
str(ak._v2.types.optiontype.OptionType(ak._v2.types.unknowntype.UnknownType()))
== "?unknown"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.listtype.ListType(ak._v2.types.unknowntype.UnknownType())
)
)
== "option[var * unknown]"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10
)
)
)
== "option[10 * unknown]"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.unknowntype.UnknownType(), {"x": 123}
)
)
== 'option[unknown, parameters={"x": 123}]'
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.listtype.ListType(ak._v2.types.unknowntype.UnknownType()),
{"x": 123},
)
)
== 'option[var * unknown, parameters={"x": 123}]'
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10
),
{"x": 123},
)
)
== 'option[10 * unknown, parameters={"x": 123}]'
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.unknowntype.UnknownType(), None, "override"
)
)
== "override"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.listtype.ListType(ak._v2.types.unknowntype.UnknownType()),
None,
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10
),
None,
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.unknowntype.UnknownType(), {"x": 123}, "override"
)
)
== "override"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.listtype.ListType(ak._v2.types.unknowntype.UnknownType()),
{"x": 123},
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10
),
{"x": 123},
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.unknowntype.UnknownType(), {"__categorical__": True}
)
)
== "categorical[type=?unknown]"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.listtype.ListType(ak._v2.types.unknowntype.UnknownType()),
{"__categorical__": True},
)
)
== "categorical[type=option[var * unknown]]"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10
),
{"__categorical__": True},
)
)
== "categorical[type=option[10 * unknown]]"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.unknowntype.UnknownType(),
{"x": 123, "__categorical__": True},
)
)
== 'categorical[type=option[unknown, parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.listtype.ListType(ak._v2.types.unknowntype.UnknownType()),
{"x": 123, "__categorical__": True},
)
)
== 'categorical[type=option[var * unknown, parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10
),
{"x": 123, "__categorical__": True},
)
)
== 'categorical[type=option[10 * unknown, parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.unknowntype.UnknownType(),
{"__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.listtype.ListType(ak._v2.types.unknowntype.UnknownType()),
{"__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10
),
{"__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.unknowntype.UnknownType(),
{"x": 123, "__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.listtype.ListType(ak._v2.types.unknowntype.UnknownType()),
{"x": 123, "__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.optiontype.OptionType(
ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10
),
{"x": 123, "__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
repr(
ak._v2.types.optiontype.OptionType(
content=ak._v2.types.unknowntype.UnknownType()
)
)
== "OptionType(UnknownType())"
)
assert (
repr(
ak._v2.types.optiontype.OptionType(
content=ak._v2.types.listtype.ListType(
ak._v2.types.unknowntype.UnknownType()
)
)
)
== "OptionType(ListType(UnknownType()))"
)
assert (
repr(
ak._v2.types.optiontype.OptionType(
content=ak._v2.types.regulartype.RegularType(
ak._v2.types.unknowntype.UnknownType(), 10
),
parameters={"x": 123, "__categorical__": True},
typestr="override",
)
)
== "OptionType(RegularType(UnknownType(), 10), parameters={'x': 123, '__categorical__': True}, typestr='override')"
)
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_UnionType():
assert (
str(
ak._v2.types.uniontype.UnionType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
]
)
)
== "union[unknown, bool]"
)
assert (
str(
ak._v2.types.uniontype.UnionType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
{"x": 123},
)
)
== 'union[unknown, bool, parameters={"x": 123}]'
)
assert (
str(
ak._v2.types.uniontype.UnionType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
None,
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.uniontype.UnionType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
{"x": 123},
"override",
)
)
== "override"
)
assert (
str(
ak._v2.types.uniontype.UnionType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
{"__categorical__": True},
)
)
== "categorical[type=union[unknown, bool]]"
)
assert (
str(
ak._v2.types.uniontype.UnionType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
{"x": 123, "__categorical__": True},
)
)
== 'categorical[type=union[unknown, bool, parameters={"x": 123}]]'
)
assert (
str(
ak._v2.types.uniontype.UnionType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
{"__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
str(
ak._v2.types.uniontype.UnionType(
[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
{"x": 123, "__categorical__": True},
"override",
)
)
== "categorical[type=override]"
)
assert (
repr(
ak._v2.types.uniontype.UnionType(
contents=[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
]
)
)
== "UnionType([UnknownType(), NumpyType('bool')])"
)
assert (
repr(
ak._v2.types.uniontype.UnionType(
contents=[
ak._v2.types.unknowntype.UnknownType(),
ak._v2.types.numpytype.NumpyType("bool"),
],
parameters={"x": 123, "__categorical__": True},
typestr="override",
)
)
== "UnionType([UnknownType(), NumpyType('bool')], parameters={'x': 123, '__categorical__': True}, typestr='override')"
)
def test_ArrayType():
assert (
str(
ak._v2.types.arraytype.ArrayType(ak._v2.types.unknowntype.UnknownType(), 10)
)
== "10 * unknown"
)
assert (
str(ak._v2.types.arraytype.ArrayType(ak._v2.types.unknowntype.UnknownType(), 0))
== "0 * unknown"
)
with pytest.raises(ValueError):
ak._v2.types.arraytype.ArrayType(ak._v2.types.unknowntype.UnknownType(), -1)
# ArrayType should not have these arguments (should not be a Type subclass)
with pytest.raises(TypeError):
ak._v2.types.arraytype.ArrayType(
ak._v2.types.unknowntype.UnknownType(), 10, {"x": 123}
)
with pytest.raises(TypeError):
ak._v2.types.arraytype.ArrayType(
ak._v2.types.unknowntype.UnknownType(), 10, None, "override"
)
assert (
repr(
ak._v2.types.arraytype.ArrayType(
content=ak._v2.types.unknowntype.UnknownType(), length=10
)
)
== "ArrayType(UnknownType(), 10)"
)
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_EmptyForm():
assert (
str(ak._v2.forms.emptyform.EmptyForm())
== """{
"class": "EmptyArray"
}"""
)
assert (
str(
ak._v2.forms.emptyform.EmptyForm(
has_identifier=True, parameters={"x": 123}, form_key="hello"
)
)
== """{
"class": "EmptyArray",
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert repr(ak._v2.forms.emptyform.EmptyForm()) == "EmptyForm()"
assert (
repr(
ak._v2.forms.emptyform.EmptyForm(
has_identifier=True, parameters={"x": 123}, form_key="hello"
)
)
== "EmptyForm(has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.emptyform.EmptyForm().tolist(verbose=False) == {
"class": "EmptyArray"
}
assert ak._v2.forms.emptyform.EmptyForm().tolist() == {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.emptyform.EmptyForm(
has_identifier=True, parameters={"x": 123}, form_key="hello"
).tolist(verbose=False) == {
"class": "EmptyArray",
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter({"class": "EmptyArray"}).tolist() == {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "EmptyArray",
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist() == {
"class": "EmptyArray",
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
@pytest.mark.skipif(
ak._util.win,
reason="NumPy does not have float16, float128, and complex256 -- on Windows",
)
def test_NumpyForm():
assert (
str(ak._v2.forms.numpyform.NumpyForm("bool"))
== """{
"class": "NumpyArray",
"primitive": "bool"
}"""
)
assert (
repr(ak._v2.forms.numpyform.NumpyForm(primitive="bool")) == "NumpyForm('bool')"
)
assert (
repr(
ak._v2.forms.numpyform.NumpyForm(
primitive="bool",
inner_shape=[1, 2, 3],
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "NumpyForm('bool', inner_shape=(1, 2, 3), has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.numpyform.NumpyForm("bool").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "bool",
}
assert ak._v2.forms.numpyform.NumpyForm("bool").tolist() == {
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [],
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.numpyform.NumpyForm(
"bool",
inner_shape=[1, 2, 3],
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [1, 2, 3],
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.numpyform.NumpyForm("bool").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "bool",
}
assert ak._v2.forms.numpyform.NumpyForm("int8").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "int8",
}
assert ak._v2.forms.numpyform.NumpyForm("uint8").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint8",
}
assert ak._v2.forms.numpyform.NumpyForm("int16").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "int16",
}
assert ak._v2.forms.numpyform.NumpyForm("uint16").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint16",
}
assert ak._v2.forms.numpyform.NumpyForm("int32").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "int32",
}
assert ak._v2.forms.numpyform.NumpyForm("uint32").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint32",
}
assert ak._v2.forms.numpyform.NumpyForm("int64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "int64",
}
assert ak._v2.forms.numpyform.NumpyForm("uint64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint64",
}
assert ak._v2.forms.numpyform.NumpyForm("float16").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float16",
}
assert ak._v2.forms.numpyform.NumpyForm("float32").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float32",
}
assert ak._v2.forms.numpyform.NumpyForm("float64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float64",
}
assert ak._v2.forms.numpyform.NumpyForm("float128").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float128",
}
assert ak._v2.forms.numpyform.NumpyForm("complex64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "complex64",
}
assert ak._v2.forms.numpyform.NumpyForm("complex128").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "complex128",
}
assert ak._v2.forms.numpyform.NumpyForm("complex256").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "complex256",
}
assert ak._v2.forms.numpyform.NumpyForm("datetime64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "datetime64",
}
assert ak._v2.forms.numpyform.NumpyForm(
"datetime64", parameters={"__unit__": "s"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "datetime64",
"parameters": {"__unit__": "s"},
}
assert ak._v2.forms.numpyform.NumpyForm(
"datetime64", parameters={"__unit__": "s", "x": 123}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "datetime64",
"parameters": {"__unit__": "s", "x": 123},
}
assert ak._v2.forms.numpyform.NumpyForm("timedelta64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "timedelta64",
}
assert ak._v2.forms.numpyform.NumpyForm(
"timedelta64", parameters={"__unit__": "s"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "timedelta64",
"parameters": {"__unit__": "s"},
}
assert ak._v2.forms.numpyform.NumpyForm(
"timedelta64", parameters={"__unit__": "s", "x": 123}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "timedelta64",
"parameters": {"__unit__": "s", "x": 123},
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("bool")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "bool",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("int8")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "int8",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("uint8")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "uint8",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("int16")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "int16",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("uint16")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "uint16",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("int32")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "int32",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("uint32")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "uint32",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("int64")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "int64",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("uint64")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "uint64",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("float16")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "float16",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("float32")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "float32",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("float64")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "float64",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("float128")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "float128",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("complex64")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "complex64",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("complex128")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "complex128",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("complex256")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "complex256",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("M8")).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "datetime64",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("M8[s]")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "datetime64",
"parameters": {"__unit__": "s"},
}
assert ak._v2.forms.numpyform.from_dtype(
np.dtype("M8[s]"), parameters={"x": 123}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "datetime64",
"parameters": {"__unit__": "s", "x": 123},
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("m8")).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "timedelta64",
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype("m8[s]")).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "timedelta64",
"parameters": {"__unit__": "s"},
}
assert ak._v2.forms.numpyform.from_dtype(
np.dtype("m8[s]"), parameters={"x": 123}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "timedelta64",
"parameters": {"__unit__": "s", "x": 123},
}
assert ak._v2.forms.numpyform.from_dtype(np.dtype(("bool", (1, 2, 3)))).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [1, 2, 3],
}
with pytest.raises(TypeError):
ak._v2.forms.from_dtype(np.dtype("O")).tolist(verbose=False)
with pytest.raises(TypeError):
ak._v2.forms.from_dtype(
np.dtype([("one", np.int64), ("two", np.float64)])
).tolist(verbose=False)
assert ak._v2.forms.from_iter("bool").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "bool",
}
assert ak._v2.forms.from_iter("int8").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "int8",
}
assert ak._v2.forms.from_iter("uint8").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint8",
}
assert ak._v2.forms.from_iter("int16").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "int16",
}
assert ak._v2.forms.from_iter("uint16").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint16",
}
assert ak._v2.forms.from_iter("int32").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "int32",
}
assert ak._v2.forms.from_iter("uint32").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint32",
}
assert ak._v2.forms.from_iter("int64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "int64",
}
assert ak._v2.forms.from_iter("uint64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint64",
}
assert ak._v2.forms.from_iter("float16").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float16",
}
assert ak._v2.forms.from_iter("float32").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float32",
}
assert ak._v2.forms.from_iter("float64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float64",
}
assert ak._v2.forms.from_iter("float128").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float128",
}
assert ak._v2.forms.from_iter("complex64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "complex64",
}
assert ak._v2.forms.from_iter("complex128").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "complex128",
}
assert ak._v2.forms.from_iter("complex256").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "complex256",
}
assert ak._v2.forms.from_iter("datetime64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "datetime64",
}
assert ak._v2.forms.from_iter(
{
"class": "NumpyArray",
"primitive": "datetime64",
"parameters": {"__unit__": "s"},
}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "datetime64",
"parameters": {"__unit__": "s"},
}
assert ak._v2.forms.from_iter(
{
"class": "NumpyArray",
"primitive": "datetime64",
"parameters": {"__unit__": "s", "x": 123},
}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "datetime64",
"parameters": {"__unit__": "s", "x": 123},
}
assert ak._v2.forms.from_iter("timedelta64").tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "timedelta64",
}
assert ak._v2.forms.from_iter(
{
"class": "NumpyArray",
"primitive": "timedelta64",
"parameters": {"__unit__": "s"},
}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "timedelta64",
"parameters": {"__unit__": "s"},
}
assert ak._v2.forms.from_iter(
{
"class": "NumpyArray",
"primitive": "timedelta64",
"parameters": {"__unit__": "s", "x": 123},
}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "timedelta64",
"parameters": {"__unit__": "s", "x": 123},
}
assert ak._v2.forms.from_iter({"class": "NumpyArray", "primitive": "bool"}).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "bool",
}
assert ak._v2.forms.from_iter({"class": "NumpyArray", "primitive": "int8"}).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "int8",
}
assert ak._v2.forms.from_iter({"class": "NumpyArray", "primitive": "uint8"}).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "uint8",
}
assert ak._v2.forms.from_iter({"class": "NumpyArray", "primitive": "int16"}).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "int16",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "uint16"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint16",
}
assert ak._v2.forms.from_iter({"class": "NumpyArray", "primitive": "int32"}).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "int32",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "uint32"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint32",
}
assert ak._v2.forms.from_iter({"class": "NumpyArray", "primitive": "int64"}).tolist(
verbose=False
) == {
"class": "NumpyArray",
"primitive": "int64",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "uint64"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "uint64",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "float16"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float16",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "float32"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float32",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "float64"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float64",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "float128"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "float128",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "complex64"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "complex64",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "complex128"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "complex128",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "complex256"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "complex256",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "datetime64"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "datetime64",
}
assert ak._v2.forms.from_iter(
{"class": "NumpyArray", "primitive": "timedelta64"}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "timedelta64",
}
assert ak._v2.forms.from_iter(
{
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [1, 2, 3],
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [1, 2, 3],
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_RegularForm():
assert (
str(
ak._v2.forms.regularform.RegularForm(ak._v2.forms.emptyform.EmptyForm(), 10)
)
== """{
"class": "RegularArray",
"size": 10,
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.regularform.RegularForm(
ak._v2.forms.emptyform.EmptyForm(),
10,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "RegularArray",
"size": 10,
"content": {
"class": "EmptyArray"
},
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
repr(
ak._v2.forms.regularform.RegularForm(
content=ak._v2.forms.emptyform.EmptyForm(), size=10
)
)
== "RegularForm(EmptyForm(), 10)"
)
assert (
repr(
ak._v2.forms.regularform.RegularForm(
content=ak._v2.forms.emptyform.EmptyForm(),
size=10,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "RegularForm(EmptyForm(), 10, has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.regularform.RegularForm(
ak._v2.forms.emptyform.EmptyForm(), 10
).tolist(verbose=False) == {
"class": "RegularArray",
"size": 10,
"content": {"class": "EmptyArray"},
}
assert ak._v2.forms.regularform.RegularForm(
ak._v2.forms.emptyform.EmptyForm(), 10
).tolist() == {
"class": "RegularArray",
"size": 10,
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.regularform.RegularForm(
content=ak._v2.forms.emptyform.EmptyForm(),
size=10,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "RegularArray",
"size": 10,
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{"class": "RegularArray", "size": 10, "content": {"class": "EmptyArray"}}
).tolist() == {
"class": "RegularArray",
"size": 10,
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "RegularArray",
"size": 10,
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "RegularArray",
"size": 10,
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.regularform.RegularForm(
ak._v2.forms.numpyform.NumpyForm("bool"), 10
).tolist() == {
"class": "RegularArray",
"content": {
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [],
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"size": 10,
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.regularform.RegularForm(
ak._v2.forms.numpyform.NumpyForm("bool"), 10
).tolist(verbose=False) == {
"class": "RegularArray",
"content": "bool",
"size": 10,
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_ListForm():
assert (
str(
ak._v2.forms.listform.ListForm(
"i32", "i32", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "ListArray",
"starts": "i32",
"stops": "i32",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.listform.ListForm(
"u32", "u32", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "ListArray",
"starts": "u32",
"stops": "u32",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.listform.ListForm(
"i64", "i64", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "ListArray",
"starts": "i64",
"stops": "i64",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.listform.ListForm(
"i32",
"i32",
ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "ListArray",
"starts": "i32",
"stops": "i32",
"content": {
"class": "EmptyArray"
},
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
repr(
ak._v2.forms.listform.ListForm(
starts="i32", stops="i32", content=ak._v2.forms.emptyform.EmptyForm()
)
)
== "ListForm('i32', 'i32', EmptyForm())"
)
assert (
repr(
ak._v2.forms.listform.ListForm(
starts="i32",
stops="i32",
content=ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "ListForm('i32', 'i32', EmptyForm(), has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.listform.ListForm(
"i32", "i32", ak._v2.forms.emptyform.EmptyForm()
).tolist(verbose=False) == {
"class": "ListArray",
"starts": "i32",
"stops": "i32",
"content": {"class": "EmptyArray"},
}
assert ak._v2.forms.listform.ListForm(
"i32", "i32", ak._v2.forms.emptyform.EmptyForm()
).tolist() == {
"class": "ListArray",
"starts": "i32",
"stops": "i32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.listform.ListForm(
starts="i32",
stops="i32",
content=ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "ListArray",
"starts": "i32",
"stops": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{
"class": "ListArray",
"starts": "i32",
"stops": "i32",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "ListArray",
"starts": "i32",
"stops": "i32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "ListArray",
"starts": "u32",
"stops": "u32",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "ListArray",
"starts": "u32",
"stops": "u32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "ListArray",
"starts": "i64",
"stops": "i64",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "ListArray",
"starts": "i64",
"stops": "i64",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "ListArray",
"starts": "i32",
"stops": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "ListArray",
"starts": "i32",
"stops": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_ListOffsetForm():
assert (
str(
ak._v2.forms.listoffsetform.ListOffsetForm(
"i32", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "ListOffsetArray",
"offsets": "i32",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.listoffsetform.ListOffsetForm(
"u32", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "ListOffsetArray",
"offsets": "u32",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.listoffsetform.ListOffsetForm(
"i64", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "ListOffsetArray",
"offsets": "i64",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.listoffsetform.ListOffsetForm(
"i32",
ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "ListOffsetArray",
"offsets": "i32",
"content": {
"class": "EmptyArray"
},
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
repr(
ak._v2.forms.listoffsetform.ListOffsetForm(
offsets="i32", content=ak._v2.forms.emptyform.EmptyForm()
)
)
== "ListOffsetForm('i32', EmptyForm())"
)
assert (
repr(
ak._v2.forms.listoffsetform.ListOffsetForm(
offsets="i32",
content=ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "ListOffsetForm('i32', EmptyForm(), has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.listoffsetform.ListOffsetForm(
"i32", ak._v2.forms.emptyform.EmptyForm()
).tolist(verbose=False) == {
"class": "ListOffsetArray",
"offsets": "i32",
"content": {"class": "EmptyArray"},
}
assert ak._v2.forms.listoffsetform.ListOffsetForm(
"i32", ak._v2.forms.emptyform.EmptyForm()
).tolist() == {
"class": "ListOffsetArray",
"offsets": "i32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.listoffsetform.ListOffsetForm(
offsets="i32",
content=ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "ListOffsetArray",
"offsets": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{
"class": "ListOffsetArray",
"offsets": "i32",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "ListOffsetArray",
"offsets": "i32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "ListOffsetArray",
"offsets": "u32",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "ListOffsetArray",
"offsets": "u32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "ListOffsetArray",
"offsets": "i64",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "ListOffsetArray",
"offsets": "i64",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "ListOffsetArray",
"offsets": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "ListOffsetArray",
"offsets": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_RecordForm():
assert (
str(
ak._v2.forms.recordform.RecordForm(
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
None,
)
)
== """{
"class": "RecordArray",
"contents": [
{
"class": "EmptyArray"
},
"bool"
]
}"""
)
assert (
str(
ak._v2.forms.recordform.RecordForm(
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
["x", "y"],
)
)
== """{
"class": "RecordArray",
"contents": {
"x": {
"class": "EmptyArray"
},
"y": "bool"
}
}"""
)
assert (
str(
ak._v2.forms.recordform.RecordForm(
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
None,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "RecordArray",
"contents": [
{
"class": "EmptyArray"
},
"bool"
],
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
str(
ak._v2.forms.recordform.RecordForm(
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
["x", "y"],
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "RecordArray",
"contents": {
"x": {
"class": "EmptyArray"
},
"y": "bool"
},
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
repr(
ak._v2.forms.recordform.RecordForm(
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
None,
)
)
== "RecordForm([EmptyForm(), NumpyForm('bool')], None)"
)
assert (
repr(
ak._v2.forms.recordform.RecordForm(
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
["x", "y"],
)
)
== "RecordForm([EmptyForm(), NumpyForm('bool')], ['x', 'y'])"
)
assert (
repr(
ak._v2.forms.recordform.RecordForm(
contents=[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
keys=None,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "RecordForm([EmptyForm(), NumpyForm('bool')], None, has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert (
repr(
ak._v2.forms.recordform.RecordForm(
contents=[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
keys=["x", "y"],
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "RecordForm([EmptyForm(), NumpyForm('bool')], ['x', 'y'], has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.recordform.RecordForm(
[ak._v2.forms.emptyform.EmptyForm(), ak._v2.forms.numpyform.NumpyForm("bool")],
None,
).tolist(verbose=False) == {
"class": "RecordArray",
"contents": [
{"class": "EmptyArray"},
"bool",
],
}
assert ak._v2.forms.recordform.RecordForm(
[ak._v2.forms.emptyform.EmptyForm(), ak._v2.forms.numpyform.NumpyForm("bool")],
["x", "y"],
).tolist(verbose=False) == {
"class": "RecordArray",
"contents": {
"x": {"class": "EmptyArray"},
"y": "bool",
},
}
assert ak._v2.forms.recordform.RecordForm(
[ak._v2.forms.emptyform.EmptyForm(), ak._v2.forms.numpyform.NumpyForm("bool")],
None,
).tolist() == {
"class": "RecordArray",
"contents": [
{
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
{
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [],
"has_identifier": False,
"parameters": {},
"form_key": None,
},
],
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.recordform.RecordForm(
[ak._v2.forms.emptyform.EmptyForm(), ak._v2.forms.numpyform.NumpyForm("bool")],
["x", "y"],
).tolist() == {
"class": "RecordArray",
"contents": {
"x": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"y": {
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [],
"has_identifier": False,
"parameters": {},
"form_key": None,
},
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.recordform.RecordForm(
contents=[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
keys=None,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "RecordArray",
"contents": [
{"class": "EmptyArray"},
"bool",
],
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.recordform.RecordForm(
contents=[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
keys=["x", "y"],
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "RecordArray",
"contents": {
"x": {"class": "EmptyArray"},
"y": "bool",
},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{
"class": "RecordArray",
"contents": [
{"class": "EmptyArray"},
"bool",
],
}
).tolist() == {
"class": "RecordArray",
"contents": [
{
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
{
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [],
"has_identifier": False,
"parameters": {},
"form_key": None,
},
],
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "RecordArray",
"contents": {
"x": {"class": "EmptyArray"},
"y": "bool",
},
}
).tolist() == {
"class": "RecordArray",
"contents": {
"x": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"y": {
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [],
"has_identifier": False,
"parameters": {},
"form_key": None,
},
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "RecordArray",
"contents": [
{"class": "EmptyArray"},
"bool",
],
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "RecordArray",
"contents": [
{"class": "EmptyArray"},
"bool",
],
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{
"class": "RecordArray",
"contents": {
"x": {"class": "EmptyArray"},
"y": "bool",
},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "RecordArray",
"contents": {
"x": {"class": "EmptyArray"},
"y": "bool",
},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_IndexedForm():
assert (
str(
ak._v2.forms.indexedform.IndexedForm(
"i32", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "IndexedArray",
"index": "i32",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.indexedform.IndexedForm(
"u32", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "IndexedArray",
"index": "u32",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.indexedform.IndexedForm(
"i64", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "IndexedArray",
"index": "i64",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.indexedform.IndexedForm(
"i32",
ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "IndexedArray",
"index": "i32",
"content": {
"class": "EmptyArray"
},
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
repr(
ak._v2.forms.indexedform.IndexedForm(
index="i32", content=ak._v2.forms.emptyform.EmptyForm()
)
)
== "IndexedForm('i32', EmptyForm())"
)
assert (
repr(
ak._v2.forms.indexedform.IndexedForm(
index="i32",
content=ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "IndexedForm('i32', EmptyForm(), has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.indexedform.IndexedForm(
"i32", ak._v2.forms.emptyform.EmptyForm()
).tolist(verbose=False) == {
"class": "IndexedArray",
"index": "i32",
"content": {"class": "EmptyArray"},
}
assert ak._v2.forms.indexedform.IndexedForm(
"i32", ak._v2.forms.emptyform.EmptyForm()
).tolist() == {
"class": "IndexedArray",
"index": "i32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.indexedform.IndexedForm(
index="i32",
content=ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "IndexedArray",
"index": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{
"class": "IndexedArray",
"index": "i32",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "IndexedArray",
"index": "i32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "IndexedArray",
"index": "u32",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "IndexedArray",
"index": "u32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "IndexedArray",
"index": "i64",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "IndexedArray",
"index": "i64",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "IndexedArray",
"index": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "IndexedArray",
"index": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_IndexedOptionForm():
assert (
str(
ak._v2.forms.indexedoptionform.IndexedOptionForm(
"i32", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "IndexedOptionArray",
"index": "i32",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.indexedoptionform.IndexedOptionForm(
"i64", ak._v2.forms.emptyform.EmptyForm()
)
)
== """{
"class": "IndexedOptionArray",
"index": "i64",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.indexedoptionform.IndexedOptionForm(
"i32",
ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "IndexedOptionArray",
"index": "i32",
"content": {
"class": "EmptyArray"
},
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
repr(
ak._v2.forms.indexedoptionform.IndexedOptionForm(
index="i32", content=ak._v2.forms.emptyform.EmptyForm()
)
)
== "IndexedOptionForm('i32', EmptyForm())"
)
assert (
repr(
ak._v2.forms.indexedoptionform.IndexedOptionForm(
index="i32",
content=ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "IndexedOptionForm('i32', EmptyForm(), has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.indexedoptionform.IndexedOptionForm(
"i32", ak._v2.forms.emptyform.EmptyForm()
).tolist(verbose=False) == {
"class": "IndexedOptionArray",
"index": "i32",
"content": {"class": "EmptyArray"},
}
assert ak._v2.forms.indexedoptionform.IndexedOptionForm(
"i32", ak._v2.forms.emptyform.EmptyForm()
).tolist() == {
"class": "IndexedOptionArray",
"index": "i32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.indexedoptionform.IndexedOptionForm(
index="i32",
content=ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "IndexedOptionArray",
"index": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{
"class": "IndexedOptionArray",
"index": "i32",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "IndexedOptionArray",
"index": "i32",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "IndexedOptionArray",
"index": "i64",
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "IndexedOptionArray",
"index": "i64",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "IndexedOptionArray",
"index": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "IndexedOptionArray",
"index": "i32",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_ByteMaskedForm():
assert (
str(
ak._v2.forms.bytemaskedform.ByteMaskedForm(
"i8", ak._v2.forms.emptyform.EmptyForm(), True
)
)
== """{
"class": "ByteMaskedArray",
"mask": "i8",
"valid_when": true,
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.bytemaskedform.ByteMaskedForm(
"i8", ak._v2.forms.emptyform.EmptyForm(), False
)
)
== """{
"class": "ByteMaskedArray",
"mask": "i8",
"valid_when": false,
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.bytemaskedform.ByteMaskedForm(
"i8",
ak._v2.forms.emptyform.EmptyForm(),
True,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "ByteMaskedArray",
"mask": "i8",
"valid_when": true,
"content": {
"class": "EmptyArray"
},
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
repr(
ak._v2.forms.bytemaskedform.ByteMaskedForm(
mask="i8", content=ak._v2.forms.emptyform.EmptyForm(), valid_when=True
)
)
== "ByteMaskedForm('i8', EmptyForm(), True)"
)
assert (
repr(
ak._v2.forms.bytemaskedform.ByteMaskedForm(
mask="i8",
content=ak._v2.forms.emptyform.EmptyForm(),
valid_when=True,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "ByteMaskedForm('i8', EmptyForm(), True, has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.bytemaskedform.ByteMaskedForm(
"i8", ak._v2.forms.emptyform.EmptyForm(), True
).tolist(verbose=False) == {
"class": "ByteMaskedArray",
"mask": "i8",
"valid_when": True,
"content": {"class": "EmptyArray"},
}
assert ak._v2.forms.bytemaskedform.ByteMaskedForm(
"i8", ak._v2.forms.emptyform.EmptyForm(), True
).tolist() == {
"class": "ByteMaskedArray",
"mask": "i8",
"valid_when": True,
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.bytemaskedform.ByteMaskedForm(
mask="i8",
content=ak._v2.forms.emptyform.EmptyForm(),
valid_when=True,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "ByteMaskedArray",
"mask": "i8",
"valid_when": True,
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{
"class": "ByteMaskedArray",
"mask": "i8",
"valid_when": True,
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "ByteMaskedArray",
"mask": "i8",
"valid_when": True,
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "ByteMaskedArray",
"mask": "i64",
"valid_when": True,
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "ByteMaskedArray",
"mask": "i64",
"valid_when": True,
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "ByteMaskedArray",
"mask": "i8",
"valid_when": True,
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "ByteMaskedArray",
"mask": "i8",
"valid_when": True,
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_BitMaskedForm():
assert (
str(
ak._v2.forms.bitmaskedform.BitMaskedForm(
"u8", ak._v2.forms.emptyform.EmptyForm(), True, True
)
)
== """{
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": true,
"lsb_order": true,
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.bitmaskedform.BitMaskedForm(
"u8", ak._v2.forms.emptyform.EmptyForm(), False, True
)
)
== """{
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": false,
"lsb_order": true,
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.bitmaskedform.BitMaskedForm(
"u8", ak._v2.forms.emptyform.EmptyForm(), True, False
)
)
== """{
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": true,
"lsb_order": false,
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.bitmaskedform.BitMaskedForm(
"u8", ak._v2.forms.emptyform.EmptyForm(), False, False
)
)
== """{
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": false,
"lsb_order": false,
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.bitmaskedform.BitMaskedForm(
"u8",
ak._v2.forms.emptyform.EmptyForm(),
True,
False,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": true,
"lsb_order": false,
"content": {
"class": "EmptyArray"
},
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
repr(
ak._v2.forms.bitmaskedform.BitMaskedForm(
mask="u8",
content=ak._v2.forms.emptyform.EmptyForm(),
valid_when=True,
lsb_order=False,
)
)
== "BitMaskedForm('u8', EmptyForm(), True, False)"
)
assert (
repr(
ak._v2.forms.bitmaskedform.BitMaskedForm(
mask="u8",
content=ak._v2.forms.emptyform.EmptyForm(),
valid_when=True,
lsb_order=False,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "BitMaskedForm('u8', EmptyForm(), True, False, has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.bitmaskedform.BitMaskedForm(
"u8", ak._v2.forms.emptyform.EmptyForm(), True, False
).tolist(verbose=False) == {
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": True,
"lsb_order": False,
"content": {"class": "EmptyArray"},
}
assert ak._v2.forms.bitmaskedform.BitMaskedForm(
"u8", ak._v2.forms.emptyform.EmptyForm(), True, False
).tolist() == {
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": True,
"lsb_order": False,
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.bitmaskedform.BitMaskedForm(
mask="u8",
content=ak._v2.forms.emptyform.EmptyForm(),
valid_when=True,
lsb_order=False,
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": True,
"lsb_order": False,
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": True,
"lsb_order": False,
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": True,
"lsb_order": False,
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "BitMaskedArray",
"mask": "i64",
"valid_when": True,
"lsb_order": False,
"content": {"class": "EmptyArray"},
}
).tolist() == {
"class": "BitMaskedArray",
"mask": "i64",
"valid_when": True,
"lsb_order": False,
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": True,
"lsb_order": False,
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "BitMaskedArray",
"mask": "u8",
"valid_when": True,
"lsb_order": False,
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_UnmaskedForm():
assert (
str(ak._v2.forms.unmaskedform.UnmaskedForm(ak._v2.forms.emptyform.EmptyForm()))
== """{
"class": "UnmaskedArray",
"content": {
"class": "EmptyArray"
}
}"""
)
assert (
str(
ak._v2.forms.unmaskedform.UnmaskedForm(
ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "UnmaskedArray",
"content": {
"class": "EmptyArray"
},
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
repr(
ak._v2.forms.unmaskedform.UnmaskedForm(
content=ak._v2.forms.emptyform.EmptyForm()
)
)
== "UnmaskedForm(EmptyForm())"
)
assert (
repr(
ak._v2.forms.unmaskedform.UnmaskedForm(
content=ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "UnmaskedForm(EmptyForm(), has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.unmaskedform.UnmaskedForm(
ak._v2.forms.emptyform.EmptyForm()
).tolist(verbose=False) == {
"class": "UnmaskedArray",
"content": {"class": "EmptyArray"},
}
assert ak._v2.forms.unmaskedform.UnmaskedForm(
ak._v2.forms.emptyform.EmptyForm()
).tolist() == {
"class": "UnmaskedArray",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.unmaskedform.UnmaskedForm(
content=ak._v2.forms.emptyform.EmptyForm(),
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "UnmaskedArray",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{"class": "UnmaskedArray", "content": {"class": "EmptyArray"}}
).tolist() == {
"class": "UnmaskedArray",
"content": {
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "UnmaskedArray",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "UnmaskedArray",
"content": {"class": "EmptyArray"},
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
@pytest.mark.skipif(
ak._util.py27 or ak._util.py35, reason="Python 2.7, 3.5 have unstable dict order."
)
def test_UnionForm():
assert (
str(
ak._v2.forms.unionform.UnionForm(
"i8",
"i32",
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
)
)
== """{
"class": "UnionArray",
"tags": "i8",
"index": "i32",
"contents": [
{
"class": "EmptyArray"
},
"bool"
]
}"""
)
assert (
str(
ak._v2.forms.unionform.UnionForm(
"i8",
"u32",
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
)
)
== """{
"class": "UnionArray",
"tags": "i8",
"index": "u32",
"contents": [
{
"class": "EmptyArray"
},
"bool"
]
}"""
)
assert (
str(
ak._v2.forms.unionform.UnionForm(
"i8",
"i64",
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
)
)
== """{
"class": "UnionArray",
"tags": "i8",
"index": "i64",
"contents": [
{
"class": "EmptyArray"
},
"bool"
]
}"""
)
assert (
str(
ak._v2.forms.unionform.UnionForm(
"i8",
"i32",
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== """{
"class": "UnionArray",
"tags": "i8",
"index": "i32",
"contents": [
{
"class": "EmptyArray"
},
"bool"
],
"has_identifier": true,
"parameters": {
"x": 123
},
"form_key": "hello"
}"""
)
assert (
repr(
ak._v2.forms.unionform.UnionForm(
"i8",
"i32",
[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
)
)
== "UnionForm('i8', 'i32', [EmptyForm(), NumpyForm('bool')])"
)
assert (
repr(
ak._v2.forms.unionform.UnionForm(
tags="i8",
index="i32",
contents=[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
has_identifier=True,
parameters={"x": 123},
form_key="hello",
)
)
== "UnionForm('i8', 'i32', [EmptyForm(), NumpyForm('bool')], has_identifier=True, parameters={'x': 123}, form_key='hello')"
)
assert ak._v2.forms.unionform.UnionForm(
"i8",
"i32",
[ak._v2.forms.emptyform.EmptyForm(), ak._v2.forms.numpyform.NumpyForm("bool")],
).tolist(verbose=False) == {
"class": "UnionArray",
"tags": "i8",
"index": "i32",
"contents": [
{"class": "EmptyArray"},
"bool",
],
}
assert ak._v2.forms.unionform.UnionForm(
"i8",
"i32",
[ak._v2.forms.emptyform.EmptyForm(), ak._v2.forms.numpyform.NumpyForm("bool")],
).tolist() == {
"class": "UnionArray",
"tags": "i8",
"index": "i32",
"contents": [
{
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
{
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [],
"has_identifier": False,
"parameters": {},
"form_key": None,
},
],
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.unionform.UnionForm(
tags="i8",
index="i32",
contents=[
ak._v2.forms.emptyform.EmptyForm(),
ak._v2.forms.numpyform.NumpyForm("bool"),
],
has_identifier=True,
parameters={"x": 123},
form_key="hello",
).tolist(verbose=False) == {
"class": "UnionArray",
"tags": "i8",
"index": "i32",
"contents": [
{"class": "EmptyArray"},
"bool",
],
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
assert ak._v2.forms.from_iter(
{
"class": "UnionArray",
"tags": "i8",
"index": "i32",
"contents": [
{"class": "EmptyArray"},
"bool",
],
}
).tolist() == {
"class": "UnionArray",
"tags": "i8",
"index": "i32",
"contents": [
{
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
{
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [],
"has_identifier": False,
"parameters": {},
"form_key": None,
},
],
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "UnionArray",
"tags": "i8",
"index": "u32",
"contents": [
{"class": "EmptyArray"},
"bool",
],
}
).tolist() == {
"class": "UnionArray",
"tags": "i8",
"index": "u32",
"contents": [
{
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
{
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [],
"has_identifier": False,
"parameters": {},
"form_key": None,
},
],
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "UnionArray",
"tags": "i8",
"index": "i64",
"contents": [
{"class": "EmptyArray"},
"bool",
],
}
).tolist() == {
"class": "UnionArray",
"tags": "i8",
"index": "i64",
"contents": [
{
"class": "EmptyArray",
"has_identifier": False,
"parameters": {},
"form_key": None,
},
{
"class": "NumpyArray",
"primitive": "bool",
"inner_shape": [],
"has_identifier": False,
"parameters": {},
"form_key": None,
},
],
"has_identifier": False,
"parameters": {},
"form_key": None,
}
assert ak._v2.forms.from_iter(
{
"class": "UnionArray",
"tags": "i8",
"index": "i32",
"contents": [
{"class": "EmptyArray"},
"bool",
],
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
).tolist(verbose=False) == {
"class": "UnionArray",
"tags": "i8",
"index": "i32",
"contents": [
{"class": "EmptyArray"},
"bool",
],
"has_identifier": True,
"parameters": {"x": 123},
"form_key": "hello",
}
| 28.854767
| 161
| 0.468765
| 10,106
| 123,181
| 5.520087
| 0.019197
| 0.050048
| 0.057272
| 0.044276
| 0.970172
| 0.964238
| 0.952156
| 0.926684
| 0.912953
| 0.865325
| 0
| 0.032791
| 0.366217
| 123,181
| 4,268
| 162
| 28.861528
| 0.681773
| 0.001559
| 0
| 0.681201
| 0
| 0.003574
| 0.251856
| 0.024906
| 0
| 0
| 0
| 0
| 0.096259
| 1
| 0.004765
| false
| 0
| 0.000953
| 0
| 0.005718
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
c549469be341d0314d20ed8441e56aa198a21b25
| 6,775
|
py
|
Python
|
runner_master/runner/transforms/image/common.py
|
bigvideoresearch/SCC
|
f26cdb6aaf248b5112812dbdac1f1b5086aebccc
|
[
"MIT"
] | 5
|
2021-09-15T21:48:55.000Z
|
2022-03-22T11:21:58.000Z
|
runner_master/runner/transforms/image/common.py
|
bigvideoresearch/SCC
|
f26cdb6aaf248b5112812dbdac1f1b5086aebccc
|
[
"MIT"
] | null | null | null |
runner_master/runner/transforms/image/common.py
|
bigvideoresearch/SCC
|
f26cdb6aaf248b5112812dbdac1f1b5086aebccc
|
[
"MIT"
] | 1
|
2021-08-20T08:40:15.000Z
|
2021-08-20T08:40:15.000Z
|
from .. import image as run_trans
import torchvision.transforms as tvs_trans
from .interpolate_mapping import interpolate_any2int
STD_RATIO = 256 / 224
class PartialRemainTransform:
def __init__(self, trans1, trans2, partial=False):
if partial:
self.partial = tvs_trans.Compose(trans1)
self.remain = tvs_trans.Compose(trans2)
else:
self.partial = tvs_trans.Compose(trans1 + trans2)
self.remain = tvs_trans.Compose([])
def __call__(self, image):
return self.partial(image)
class ValidImagenet(PartialRemainTransform):
def __init__(self, image_size, ratio=STD_RATIO, interpolation='bilinear', partial=False):
interpolation = interpolate_any2int[interpolation]
if ratio is None:
pre_size = {224: 256, 299: 320, 331: 352}[image_size]
else:
pre_size = round(image_size * ratio)
trans1 = [
run_trans.Convert('RGB'),
tvs_trans.Resize(pre_size, interpolation=interpolation),
tvs_trans.CenterCrop(image_size),
tvs_trans.ToTensor(),
]
trans2 = [
run_trans.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225],
),
]
super(ValidImagenet, self).__init__(trans1, trans2, partial)
class TrainImagenet(PartialRemainTransform):
def __init__(self, image_size, ratio=STD_RATIO, interpolation='bilinear', partial=False):
interpolation = interpolate_any2int[interpolation]
trans1 = [
run_trans.Convert('RGB'),
tvs_trans.RandomResizedCrop(size=image_size, interpolation=interpolation),
tvs_trans.RandomHorizontalFlip(),
tvs_trans.ColorJitter(
brightness=0.4,
contrast=0.4,
saturation=0.4,
),
tvs_trans.ToTensor(),
]
trans2 = [
run_trans.FancyPCA(),
run_trans.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225],
),
]
super(TrainImagenet, self).__init__(trans1, trans2, partial)
class TrainColorless(PartialRemainTransform):
def __init__(self, image_size, interpolation='bilinear', partial=False):
interpolation = interpolate_any2int[interpolation]
trans1 = [
run_trans.Convert('RGB'),
tvs_trans.RandomResizedCrop(size=image_size, interpolation=interpolation),
tvs_trans.RandomHorizontalFlip(),
tvs_trans.ToTensor(),
]
trans2 = [
run_trans.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225],
),
]
super(TrainColorless, self).__init__(trans1, trans2, partial)
class TrainSinglescale(PartialRemainTransform):
def __init__(self, image_size, ratio=STD_RATIO, interpolation='bilinear', partial=False):
interpolation = interpolate_any2int[interpolation]
pre_size = round(image_size * ratio)
trans1 = [
run_trans.Convert('RGB'),
tvs_trans.Resize(pre_size, interpolation=interpolation),
tvs_trans.RandomCrop(image_size),
tvs_trans.RandomHorizontalFlip(),
tvs_trans.ColorJitter(
brightness=0.4,
contrast=0.4,
saturation=0.4,
),
tvs_trans.ToTensor(),
]
trans2 = [
run_trans.FancyPCA(),
run_trans.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225],
),
]
super(TrainSinglescale, self).__init__(trans1, trans2, partial)
class TrainAutoAugmentImageNetPolicy(PartialRemainTransform):
def __init__(self, image_size, interpolation='bilinear', partial=False):
interpolation = interpolate_any2int[interpolation]
trans1 = [
run_trans.Convert('RGB'),
tvs_trans.RandomResizedCrop(size=image_size, interpolation=interpolation),
tvs_trans.RandomHorizontalFlip(),
run_trans.ImageNetPolicy(),
tvs_trans.ToTensor(),
]
trans2 = [
run_trans.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225],
),
]
super(TrainAutoAugmentImageNetPolicy, self).__init__(trans1, trans2, partial)
class TrainAutoAugmentEfficientNetPolicy(PartialRemainTransform):
def __init__(self, image_size, interpolation='bilinear', partial=False):
interpolation = interpolate_any2int[interpolation]
trans1 = [
run_trans.Convert('RGB'),
tvs_trans.RandomResizedCrop(size=image_size, interpolation=interpolation),
tvs_trans.RandomHorizontalFlip(),
run_trans.EfficientNetPolicy(),
tvs_trans.ToTensor(),
]
trans2 = [
run_trans.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225],
),
]
super(TrainAutoAugmentEfficientNetPolicy, self).__init__(trans1, trans2, partial)
class TrainRandAugment(PartialRemainTransform):
def __init__(self, image_size, num_ops, magnitude_level, interpolation='bilinear', partial=False):
interpolation = interpolate_any2int[interpolation]
trans1 = [
run_trans.Convert('RGB'),
tvs_trans.RandomResizedCrop(size=image_size, interpolation=interpolation),
tvs_trans.RandomHorizontalFlip(),
run_trans.RandAugment(num_ops, magnitude_level),
tvs_trans.ToTensor(),
]
trans2 = [
run_trans.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225],
),
]
super(TrainRandAugment, self).__init__(trans1, trans2, partial)
class TrainRandAugmentResizedCrop(PartialRemainTransform):
def __init__(self, image_size, num_ops, magnitude_level, interpolation='bilinear', partial=False):
interpolation = interpolate_any2int[interpolation]
trans1 = [
run_trans.Convert('RGB'),
run_trans.RandAugmentResizedCrop(image_size, magnitude_level, interpolation=interpolation),
tvs_trans.RandomHorizontalFlip(),
run_trans.RandAugment(num_ops, magnitude_level),
tvs_trans.ToTensor(),
]
trans2 = [
run_trans.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225],
),
]
super(TrainRandAugmentResizedCrop, self).__init__(trans1, trans2, partial)
| 34.92268
| 103
| 0.597786
| 646
| 6,775
| 6
| 0.125387
| 0.063983
| 0.067337
| 0.076625
| 0.805986
| 0.78612
| 0.711816
| 0.711816
| 0.711816
| 0.711816
| 0
| 0.057725
| 0.296827
| 6,775
| 193
| 104
| 35.103627
| 0.755877
| 0
| 0
| 0.682927
| 0
| 0
| 0.012989
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.060976
| false
| 0
| 0.018293
| 0.006098
| 0.140244
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
c568c77b4573ed93b9724b4a625a5adcde42b1d5
| 240
|
py
|
Python
|
pdf_struct/__init__.py
|
koreyou/pdf-struct
|
2a1549f21e63c9291f4daf62d7832b87ab20f7fd
|
[
"Apache-2.0"
] | 10
|
2021-11-08T14:40:23.000Z
|
2022-03-29T13:57:33.000Z
|
pdf_struct/__init__.py
|
koreyou/pdf-struct
|
2a1549f21e63c9291f4daf62d7832b87ab20f7fd
|
[
"Apache-2.0"
] | 1
|
2022-03-04T11:48:16.000Z
|
2022-03-09T15:43:36.000Z
|
pdf_struct/__init__.py
|
koreyou/pdf-struct
|
2a1549f21e63c9291f4daf62d7832b87ab20f7fd
|
[
"Apache-2.0"
] | 4
|
2021-12-25T22:12:06.000Z
|
2022-03-13T17:44:10.000Z
|
from pdf_struct._version import __version__
from pdf_struct import core
from pdf_struct import export
from pdf_struct import feature_extractor
from pdf_struct import features
from pdf_struct import loader
from pdf_struct.cli import predict
| 30
| 43
| 0.875
| 38
| 240
| 5.184211
| 0.342105
| 0.248731
| 0.461929
| 0.482234
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116667
| 240
| 7
| 44
| 34.285714
| 0.929245
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 6
|
3de9fcc4d67dc3ee6b33da3f386b3a7585b38834
| 240
|
py
|
Python
|
python/taichi/types/__init__.py
|
hikaru-sysu/taichi
|
73bd8451c306e87b0e159a4853d4b05f77c25458
|
[
"MIT"
] | null | null | null |
python/taichi/types/__init__.py
|
hikaru-sysu/taichi
|
73bd8451c306e87b0e159a4853d4b05f77c25458
|
[
"MIT"
] | null | null | null |
python/taichi/types/__init__.py
|
hikaru-sysu/taichi
|
73bd8451c306e87b0e159a4853d4b05f77c25458
|
[
"MIT"
] | null | null | null |
from taichi.types.annotations import *
from taichi.types.compound_types import *
from taichi.types.ndarray_type import *
from taichi.types.primitive_types import *
from taichi.types.quantized_types import *
from taichi.types.utils import *
| 34.285714
| 42
| 0.825
| 34
| 240
| 5.705882
| 0.323529
| 0.309278
| 0.463918
| 0.541237
| 0.402062
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 240
| 6
| 43
| 40
| 0.898148
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 6
|
9a75df9ccdd1a2b7465e0bd7e23be58634b5291b
| 104
|
py
|
Python
|
app/diet_diary/__init__.py
|
MartinHeinz/LifestyleTracker
|
87975b85c78182cd184b31f436c62967e76289ee
|
[
"MIT"
] | 2
|
2020-01-19T11:39:26.000Z
|
2020-02-11T12:19:46.000Z
|
app/diet_diary/__init__.py
|
MartinHeinz/LifestyleTracker
|
87975b85c78182cd184b31f436c62967e76289ee
|
[
"MIT"
] | null | null | null |
app/diet_diary/__init__.py
|
MartinHeinz/LifestyleTracker
|
87975b85c78182cd184b31f436c62967e76289ee
|
[
"MIT"
] | 2
|
2020-10-20T05:42:42.000Z
|
2022-03-18T13:27:35.000Z
|
from flask import Blueprint
diet_diary = Blueprint('diet_diary', __name__)
from . import views # noqa
| 20.8
| 46
| 0.769231
| 14
| 104
| 5.285714
| 0.642857
| 0.351351
| 0.486486
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.153846
| 104
| 5
| 47
| 20.8
| 0.840909
| 0.038462
| 0
| 0
| 0
| 0
| 0.10101
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0.666667
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
|
0
| 6
|
9a8d4e7cfd070a36be7a02a19bc05882e15007e1
| 217
|
py
|
Python
|
App/__init__.py
|
passed-by/WeatherTornado
|
05f1ccc56b93c3267d65fbee312de4b99fb1a5e4
|
[
"MIT"
] | null | null | null |
App/__init__.py
|
passed-by/WeatherTornado
|
05f1ccc56b93c3267d65fbee312de4b99fb1a5e4
|
[
"MIT"
] | null | null | null |
App/__init__.py
|
passed-by/WeatherTornado
|
05f1ccc56b93c3267d65fbee312de4b99fb1a5e4
|
[
"MIT"
] | null | null | null |
import tornado.web
from App.urls import patterns
from App.settings import app_settings
# 创建应用,并设置了路由规则
def make_app():
return tornado.web.Application(
handlers=patterns,
**app_settings,
)
| 14.466667
| 37
| 0.700461
| 27
| 217
| 5.518519
| 0.555556
| 0.221477
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.221198
| 217
| 14
| 38
| 15.5
| 0.881657
| 0.059908
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| true
| 0
| 0.375
| 0.125
| 0.625
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 1
| 0
|
0
| 6
|
9acef8cd8484dfe998b9b4e90c87fb08ab29eea0
| 62
|
py
|
Python
|
kats/models/reconciliation/__init__.py
|
menefotto/Kats
|
3fc8a3f819502d45736734eabb3601f42a6b7759
|
[
"MIT"
] | 1
|
2021-06-22T03:40:33.000Z
|
2021-06-22T03:40:33.000Z
|
kats/models/reconciliation/__init__.py
|
menefotto/Kats
|
3fc8a3f819502d45736734eabb3601f42a6b7759
|
[
"MIT"
] | null | null | null |
kats/models/reconciliation/__init__.py
|
menefotto/Kats
|
3fc8a3f819502d45736734eabb3601f42a6b7759
|
[
"MIT"
] | null | null | null |
from . import base_models # noqa
from . import thm # noqa
| 20.666667
| 34
| 0.677419
| 9
| 62
| 4.555556
| 0.666667
| 0.487805
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.258065
| 62
| 2
| 35
| 31
| 0.891304
| 0.145161
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
b1110e26aa32f214eeedfe8ec1339ea35b5218de
| 29
|
py
|
Python
|
metatools/apps/__init__.py
|
westernx/metatools
|
dcaaf3402a4cda2a28f2a78e38fb6f1661fc9821
|
[
"BSD-3-Clause"
] | 1
|
2016-09-18T14:22:06.000Z
|
2016-09-18T14:22:06.000Z
|
metatools/apps/__init__.py
|
westernx/metatools
|
dcaaf3402a4cda2a28f2a78e38fb6f1661fc9821
|
[
"BSD-3-Clause"
] | null | null | null |
metatools/apps/__init__.py
|
westernx/metatools
|
dcaaf3402a4cda2a28f2a78e38fb6f1661fc9821
|
[
"BSD-3-Clause"
] | null | null | null |
from .build import build_app
| 14.5
| 28
| 0.827586
| 5
| 29
| 4.6
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137931
| 29
| 1
| 29
| 29
| 0.92
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
b12e8d1629246b707c6d3766ec5fadae0e4fdafd
| 33
|
py
|
Python
|
twython/streaming/__init__.py
|
vaidashwin/twython
|
cf01359855fecc28d300e4ae396ca8a984d3657d
|
[
"MIT"
] | 1,154
|
2015-01-02T02:39:41.000Z
|
2022-03-30T12:04:03.000Z
|
twython/streaming/__init__.py
|
antrofranc-ai/twython
|
0c405604285364457f3c309969f11ba68163bd05
|
[
"MIT"
] | 213
|
2015-01-26T18:04:40.000Z
|
2021-12-31T00:29:52.000Z
|
twython/streaming/__init__.py
|
antrofranc-ai/twython
|
0c405604285364457f3c309969f11ba68163bd05
|
[
"MIT"
] | 294
|
2015-01-04T22:33:20.000Z
|
2022-03-29T16:47:36.000Z
|
from .api import TwythonStreamer
| 16.5
| 32
| 0.848485
| 4
| 33
| 7
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.121212
| 33
| 1
| 33
| 33
| 0.965517
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
b1384967a66c0d2f6bbda69a98cd111084a128c0
| 19
|
py
|
Python
|
final_project/machinetranslation/tests/__init__.py
|
rawan-alsubeai/xzceb-flask_eng_fr
|
757f2509a534d105aa6eb186fb75e135b478c4d5
|
[
"Apache-2.0"
] | null | null | null |
final_project/machinetranslation/tests/__init__.py
|
rawan-alsubeai/xzceb-flask_eng_fr
|
757f2509a534d105aa6eb186fb75e135b478c4d5
|
[
"Apache-2.0"
] | null | null | null |
final_project/machinetranslation/tests/__init__.py
|
rawan-alsubeai/xzceb-flask_eng_fr
|
757f2509a534d105aa6eb186fb75e135b478c4d5
|
[
"Apache-2.0"
] | null | null | null |
from . import tests
| 19
| 19
| 0.789474
| 3
| 19
| 5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 19
| 1
| 19
| 19
| 0.9375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
49627b7a7dffed9a99dee59fef7a708361b19a25
| 13,358
|
py
|
Python
|
rnn/model.py
|
lorylei/DARTS-et
|
f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8
|
[
"Apache-2.0"
] | 1
|
2020-12-29T14:44:00.000Z
|
2020-12-29T14:44:00.000Z
|
rnn/model.py
|
lorylei/DARTS-et
|
f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8
|
[
"Apache-2.0"
] | null | null | null |
rnn/model.py
|
lorylei/DARTS-et
|
f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8
|
[
"Apache-2.0"
] | null | null | null |
import torch
import torch.nn as nn
import torch.nn.functional as F
from operations import *
from torch.autograd import Variable
import math
# genotype = {'gene_encoder': [{'combine_func': 'cat', 'left_activation': 'Swish', 'left_input': 1, 'left_layer': 'SA_h8', 'left_norm': 'batch_norm', 'right_activation': 'Swish', 'right_input': 0, 'right_layer': 'SA_h8', 'right_norm': 'batch_norm'}, {'combine_func': 'mul', 'left_activation': 'Swish', 'left_input': 2, 'left_layer': 'SA_h8', 'left_norm': 'none', 'right_activation': 'Swish', 'right_input': 2, 'right_layer': 'conv1d_1x1', 'right_norm': 'none'}, {'combine_func': 'add', 'left_activation': 'ReLU', 'left_input': 1, 'left_layer': 'identity', 'left_norm': 'batch_norm', 'right_activation': 'ReLU', 'right_input': 1, 'right_layer': 'GLU', 'right_norm': 'batch_norm'}, {'combine_func': 'add', 'left_activation': 'none', 'left_input': 4, 'left_layer': 'identity', 'left_norm': 'batch_norm', 'right_activation': 'none', 'right_input': 4, 'right_layer': 'identity', 'right_norm': 'batch_norm'}], 'gene_decoder': [{'combine_func': 'add', 'left_activation': 'ReLU', 'left_input': 0, 'left_layer': 'Att_En_h8', 'left_norm': 'batch_norm', 'right_activation': 'Swish', 'right_input': 0, 'right_layer': 'FFN_4', 'right_norm': 'none'}, {'combine_func': 'add', 'left_activation': 'none', 'left_input': 2, 'left_layer': 'Att_En_h8', 'left_norm': 'none', 'right_activation': 'none', 'right_input': 2, 'right_layer': 'Att_En_h8', 'right_norm': 'none'}, {'combine_func': 'add', 'left_activation': 'none', 'left_input': 3, 'left_layer': 'identity', 'left_norm': 'batch_norm', 'right_activation': 'ReLU', 'right_input': 3, 'right_layer': 'identity', 'right_norm': 'batch_norm'}, {'combine_func': 'mul', 'left_activation': 'ReLU', 'left_input': 4, 'left_layer': 'GLU', 'left_norm': 'none', 'right_activation': 'ReLU', 'right_input': 4, 'right_layer': 'conv1d_1x1', 'right_norm': 'none'}, {'combine_func': 'cat', 'left_activation': 'ReLU', 'left_input': 4, 'left_layer': 'conv1d_3x3', 'left_norm': 'none', 'right_activation': 'ReLU', 'right_input': 4, 'right_layer': 'conv1d_1x1', 'right_norm': 'none'}, {'combine_func': 'mul', 'left_activation': 'Swish', 'left_input': 4, 'left_layer': 'identity', 'left_norm': 'batch_norm', 'right_activation': 'ReLU', 'right_input': 3, 'right_layer': 'identity', 'right_norm': 'batch_norm'}]}
class TwoBranchOp(nn.Module):
def __init__(self, C, gene, decode=False):
super(TwoBranchOp, self).__init__()
self.decode = decode
self.left_input = gene['left_input']
self.right_input = gene['right_input']
# self._norm_ops_l = Norm_OPS[gene['left_norm']](C, False)
# self._norm_ops_r = Norm_OPS[gene['right_norm']](C, False)
if decode:
Layer_OPS = De_Layer_OPS
else:
Layer_OPS = En_Layer_OPS
self._layer_ops_l = Layer_OPS[gene['left_layer']](C)
self._layer_ops_r = Layer_OPS[gene['right_layer']](C)
self._act_ops_l = Act_OPS[gene['left_activation']]()
self._act_ops_r = Act_OPS[gene['right_activation']]()
self._cmb_ops = Cmb_OPS[gene['combine_func']](C)
self._norm_ops = Norm_OPS[gene['norm']](C, False)
def forward(self, x, mask, memory=None): #weights: dict {left_input:[], left_norm:[], left_layer:[], left_activation:[], right.... combine_func:[]}
left_x = x[self.left_input]
# left_x = self._norm_ops_l(left_x)
if self.decode:
left_x = self._layer_ops_l(left_x, mask, memory)
else:
left_x = self._layer_ops_l(left_x, mask)
left_x = self._act_ops_l(left_x)
right_x = x[self.right_input]
# right_x = self._norm_ops_r(right_x)
if self.decode:
right_x = self._layer_ops_r(right_x, mask, memory)
else:
right_x = self._layer_ops_r(right_x, mask)
right_x = self._act_ops_r(right_x)
x = self._cmb_ops(left_x, right_x)
x = self._norm_ops(x)
return x
class EvolvedCell(nn.Module):
def __init__(self, C, genotype, decode=False):
super(EvolvedCell, self).__init__()
if decode:
gene = genotype['gene_decoder']
else:
gene = genotype['gene_encoder']
self._steps = len(gene)
self._ops = nn.ModuleList()
for i in range(self._steps):
op = TwoBranchOp(C, gene[i], decode)
self._ops.append(op)
def forward(self, s0, s1, mask, memory=None):
states = [s0, s1]
for i in range(self._steps):
s = self._ops[i](states, mask, memory)
states.append(s)
return states[-1]
class PositionalEncoding(nn.Module):
def __init__(self, d_model, dropout=0.1, max_len=5000):
super(PositionalEncoding, self).__init__()
self.dropout = nn.Dropout(p=dropout)
pe = torch.zeros(max_len, d_model)
position = torch.arange(0, max_len, dtype=torch.float).unsqueeze(1)
div_term = torch.exp(torch.arange(0, d_model, 2).float() * (-math.log(10000.0) / d_model))
pe[:, 0::2] = torch.sin(position * div_term)
pe[:, 1::2] = torch.cos(position * div_term)
pe = pe.unsqueeze(0).transpose(0, 1)
self.register_buffer('pe', pe)
def forward(self, x):
x = x + self.pe[:x.size(0), :]
return self.dropout(x)
class Network(nn.Module):
def __init__(self, C, input_vocab, output_vocab, en_layers, de_layers, criterion, padding_idx, genotype, sos_idx, eos_idx):
super(Network, self).__init__()
self._C = C
self._input_vocab = input_vocab
self._output_vocab = output_vocab
self._en_layers = en_layers
self._de_layers = de_layers
self._criterion = criterion
self._pad_idx = padding_idx
self._sos_idx = sos_idx
self._eos_idx = eos_idx
self.embed_input = nn.Embedding(input_vocab, C)
self.dropout = nn.Dropout(0.1)
self.pos_encoder = PositionalEncoding(C)
self.en_cells = nn.ModuleList()
for i in range(en_layers):
cell = EvolvedCell(C, genotype, decode=False)
self.en_cells += [cell]
self.embed_target = nn.Embedding(output_vocab, C)
self.de_cells = nn.ModuleList()
for i in range(de_layers):
cell = EvolvedCell(C, genotype, decode=True)
self.de_cells += [cell]
self.classifier = nn.Linear(C, output_vocab)
# self._initialize_alphas()
def forward(self, input, target):
mask = (input == self._pad_idx).t().contiguous()
# print('padding idx:', self._pad_idx)
# print(input)
# print(target)
input = self.dropout(self.embed_input(input))
input = self.pos_encoder(input)
s0 = s1 = input
for i, cell in enumerate(self.en_cells):
s0, s1 = s1, cell(s0, s1, mask)
memory = s1
target = self.dropout(self.embed_target(target))
target = self.pos_encoder(target)
s0 = s1 = target
for i, cell in enumerate(self.de_cells):
s0, s1 = s1, cell(s0, s1, mask, memory)
logits = self.classifier(s1)
logits = logits.view(-1, logits.size(-1))
return logits
def _loss(self, input, target):
logits = self(input, target[:-1])
return self._criterion(logits, target[1:].view(-1))
def decode(self, input, max_len=50):
mask = (input == self._pad_idx).t().contiguous()
batch_size = input.size(1)
device = input.device
# print('padding idx:', self._pad_idx)
# print(input)
# print(target)
input = self.dropout(self.embed_input(input))
input = self.pos_encoder(input)
s0 = s1 = input
for i, cell in enumerate(self.en_cells):
s0, s1 = s1, cell(s0, s1, mask)
memory = s1
input_token = torch.full((1,batch_size), self._sos_idx, dtype=torch.long, device=device)
has_ended = torch.zeros(batch_size, dtype=torch.bool, device=device)
for i in range(max_len):
target = self.dropout(self.embed_target(input_token))
target = self.pos_encoder(target)
s0 = s1 = target
for i, cell in enumerate(self.de_cells):
s0, s1 = s1, cell(s0, s1, mask, memory)
logits = self.classifier(s1)
next_token = torch.argmax(logits[-1], dim=-1)
input_token = torch.cat((input_token, next_token.unsqueeze(0)), dim=0)
has_ended = has_ended | (next_token == self._eos_idx)
if has_ended.sum().item() == has_ended.size(0):
break
return input_token
class Baseline(nn.Module):
def __init__(self, C, input_vocab, output_vocab, en_layers, de_layers, criterion, padding_idx, genotype, sos_idx, eos_idx):
super(Baseline, self).__init__()
self._C = C
self._input_vocab = input_vocab
self._output_vocab = output_vocab
self._en_layers = en_layers
self._de_layers = de_layers
self._criterion = criterion
self._pad_idx = padding_idx
self._sos_idx = sos_idx
self._eos_idx = eos_idx
self.embed_input = nn.Embedding(input_vocab, C)
self.dropout = nn.Dropout(0.1)
self.pos_encoder = PositionalEncoding(C)
encoder_layer = nn.TransformerEncoderLayer(C, 8)
self.encoder = nn.TransformerEncoder(encoder_layer, en_layers)
self.embed_target = nn.Embedding(output_vocab, C)
decoder_layer = nn.TransformerDecoderLayer(C, 8)
self.decoder = nn.TransformerDecoder(decoder_layer, de_layers)
self.classifier = nn.Linear(C, output_vocab)
def forward(self, input, target):
mask = (input == self._pad_idx).t().contiguous()
device = target.device
decode_mask = torch.triu( torch.ones(len(target), len(target)) ).t().to(device) == 0
# print('padding idx:', self._pad_idx)
# print(input)
# print(target)
input = self.dropout(self.embed_input(input))
input = self.pos_encoder(input)
memory = self.encoder(input, src_key_padding_mask=mask)
target = self.dropout(self.embed_target(target))
target = self.pos_encoder(target)
target = self.decoder(target, memory, tgt_mask=decode_mask, memory_key_padding_mask=mask)
logits = self.classifier(target)
logits = logits.view(-1, logits.size(-1))
return logits
def _loss(self, input, target):
logits = self(input, target[:-1])
return self._criterion(logits, target[1:].view(-1))
def decode(self, input, max_len=50):
mask = (input == self._pad_idx).t().contiguous()
batch_size = input.size(1)
device = input.device
# print('padding idx:', self._pad_idx)
# print(input)
# print(target)
input = self.dropout(self.embed_input(input))
input = self.pos_encoder(input)
memory = self.encoder(input, src_key_padding_mask=mask)
input_token = torch.full((1,batch_size), self._sos_idx, dtype=torch.long, device=device)
has_ended = torch.zeros(batch_size, dtype=torch.bool, device=device)
for i in range(max_len):
decode_mask = torch.triu( torch.ones(len(input_token), len(input_token)) ).t().to(device) == 0
target = self.dropout(self.embed_target(input_token))
target = self.pos_encoder(target)
target = self.decoder(target, memory, tgt_mask=decode_mask, memory_key_padding_mask=mask)
logits = self.classifier(target)
next_token = torch.argmax(logits[-1], dim=-1)
input_token = torch.cat((input_token, next_token.unsqueeze(0)), dim=0)
has_ended = has_ended | (next_token == self._eos_idx)
if has_ended.sum().item() == has_ended.size(0):
break
return input_token
# genotype = {'gene_encoder': [{'combine_func': 'cat', 'left_activation': 'Swish', 'left_input': 1, 'left_layer': 'SA_h8', 'left_norm': 'batch_norm', 'right_activation': 'Swish', 'right_input': 0, 'right_layer': 'SA_h8', 'right_norm': 'batch_norm'}, {'combine_func': 'mul', 'left_activation': 'Swish', 'left_input': 2, 'left_layer': 'SA_h8', 'left_norm': 'none', 'right_activation': 'Swish', 'right_input': 2, 'right_layer': 'conv1d_1x1', 'right_norm': 'none'}, {'combine_func': 'add', 'left_activation': 'ReLU', 'left_input': 1, 'left_layer': 'identity', 'left_norm': 'batch_norm', 'right_activation': 'ReLU', 'right_input': 1, 'right_layer': 'GLU', 'right_norm': 'batch_norm'}, {'combine_func': 'add', 'left_activation': 'none', 'left_input': 4, 'left_layer': 'identity', 'left_norm': 'batch_norm', 'right_activation': 'none', 'right_input': 4, 'right_layer': 'identity', 'right_norm': 'batch_norm'}], 'gene_decoder': [{'combine_func': 'add', 'left_activation': 'ReLU', 'left_input': 0, 'left_layer': 'Att_En_h8', 'left_norm': 'batch_norm', 'right_activation': 'Swish', 'right_input': 0, 'right_layer': 'FFN_4', 'right_norm': 'none'}, {'combine_func': 'add', 'left_activation': 'none', 'left_input': 2, 'left_layer': 'Att_En_h8', 'left_norm': 'none', 'right_activation': 'none', 'right_input': 2, 'right_layer': 'Att_En_h8', 'right_norm': 'none'}, {'combine_func': 'add', 'left_activation': 'none', 'left_input': 3, 'left_layer': 'identity', 'left_norm': 'batch_norm', 'right_activation': 'ReLU', 'right_input': 3, 'right_layer': 'identity', 'right_norm': 'batch_norm'}, {'combine_func': 'mul', 'left_activation': 'ReLU', 'left_input': 4, 'left_layer': 'GLU', 'left_norm': 'none', 'right_activation': 'ReLU', 'right_input': 4, 'right_layer': 'conv1d_1x1', 'right_norm': 'none'}, {'combine_func': 'cat', 'left_activation': 'ReLU', 'left_input': 4, 'left_layer': 'conv1d_3x3', 'left_norm': 'none', 'right_activation': 'ReLU', 'right_input': 4, 'right_layer': 'conv1d_1x1', 'right_norm': 'none'}, {'combine_func': 'mul', 'left_activation': 'Swish', 'left_input': 4, 'left_layer': 'identity', 'left_norm': 'batch_norm', 'right_activation': 'ReLU', 'right_input': 3, 'right_layer': 'identity', 'right_norm': 'batch_norm'}]}
| 47.537367
| 2,220
| 0.671732
| 1,912
| 13,358
| 4.387029
| 0.085251
| 0.025751
| 0.034096
| 0.02432
| 0.775751
| 0.773486
| 0.750119
| 0.727945
| 0.718884
| 0.705532
| 0
| 0.015572
| 0.158706
| 13,358
| 280
| 2,221
| 47.707143
| 0.730824
| 0.374981
| 0
| 0.598985
| 0
| 0
| 0.013809
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.071066
| false
| 0
| 0.030457
| 0
| 0.172589
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
49718345ae9a1b1fa85cc8c274eba1c382d7af9c
| 45,124
|
py
|
Python
|
pymatflow/cp2k/base/dft_qs.py
|
DeqiTang/pymatflow
|
bd8776feb40ecef0e6704ee898d9f42ded3b0186
|
[
"MIT"
] | 6
|
2020-03-06T16:13:08.000Z
|
2022-03-09T07:53:34.000Z
|
pymatflow/cp2k/base/dft_qs.py
|
DeqiTang/pymatflow
|
bd8776feb40ecef0e6704ee898d9f42ded3b0186
|
[
"MIT"
] | 1
|
2021-10-02T02:23:08.000Z
|
2021-11-08T13:29:37.000Z
|
pymatflow/cp2k/base/dft_qs.py
|
DeqiTang/pymatflow
|
bd8776feb40ecef0e6704ee898d9f42ded3b0186
|
[
"MIT"
] | 1
|
2021-07-10T16:28:14.000Z
|
2021-07-10T16:28:14.000Z
|
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
# ============================
# CP2K / FORCE_EVAL / DFT / QS
# ============================
class cp2k_dft_qs_becke_constraint_atom_group:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&ATOM_GROUP\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END ATOM_GROUP\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_becke_constraint_dummy_atoms:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&DUMMY_ATOMS\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END DUMMY_ATOMS\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_becke_constraint_program_run_info_each:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t&EACH\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t\t&END EACH\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 6:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_becke_constraint_program_run_info:
def __init__(self):
self.params = {
}
self.status = False
self.each = cp2k_dft_qs_becke_constraint_program_run_info_each()
# basic setting
self.each.status = True
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&PROGRAM_RUN_INFO\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.each.status == True:
self.each.to_input(fout)
fout.write("\t\t\t\t&END PRQOGRAM_RUN_INFO\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[4] == "EACH":
self.each.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_becke_constraint:
def __init__(self):
self.params = {
}
self.status = False
self.atom_group = cp2k_dft_qs_becke_constraint_atom_group()
self.dummy_atoms = cp2k_dft_qs_becke_constraint_dummy_atoms()
self.program_run_info = cp2k_dft_qs_becke_constraint_program_run_info()
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&BECKE_CONSTRAINT\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.atom_group.status == True:
self.atom_group.to_input(fout)
if self.dummy_atoms.status == True:
self.dummy.to_input(fout)
if self.program_run_info.status == True:
self.program_run_info.to_input(fout)
fout.write("\t\t\t&END BECKE_CONSTRAINT\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[3] == "ATOM_GROUP":
self.atom_group.set_params({item: params[item]})
elif item.split("-")[3] == "DUMMY_ATOMS":
self.dummy_atoms.set_params({item: params[item]})
elif item.split("-")[3] == "PROGRAM_RUN_INFO":
self.program_run_info.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_cdft_hirshfeld_constraint_program_run_info_each:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t\t&EACH\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t\t\t&END EACH\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 7:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_cdft_hirshfeld_constraint_program_run_info:
def __init__(self):
self.params = {
}
self.status = False
self.each = cp2k_dft_qs_cdft_hirshfeld_constraint_program_run_info_each()
# basic setting
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t&PROGRAM_RUN_INFO\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.each.status == True:
self.each.to_input(fout)
fout.write("\t\t\t\t\t&END PROGRAM_RUN_INFO\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 6:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[5] == "EACH":
self.each.to_input(fout)
else:
pass
class cp2k_dft_qs_cdft_hirshfeld_constraint:
def __init__(self):
self.params = {
}
self.status = False
self.program_run_info = cp2k_dft_qs_cdft_hirshfeld_constraint_program_run_info()
# basic_setting
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&HIRSHFELD_CONSTRAINT\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.program_run_info.status == True:
self.program_run_info.to_input(fout)
fout.write("\t\t\t\t&END HIRSHFELD_CONSTRAINT\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[4] == "PROGRAM_RUN_INFO":
self.program_run_info.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_cdft_outer_scf_cdft_opt:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t&CDFT_OPT\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t\t&END CDFT_OPT\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 6:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_cdft_outer_scf:
def __init__(self):
self.params = {
}
self.status = False
self.cdft_opt = cp2k_dft_qs_cdft_outer_scf_cdft_opt()
# basic setting
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&OUTER_SCF\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.cdft_opt.status == True:
self.cdft_opt.to_input(fout)
fout.write("\t\t\t\t&END OUTER_SCF\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[4] == "CDFT_OPT":
self.cdft_opt.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_cdft:
def __init__(self):
self.params = {
}
self.status = False
self.hirshfeld_constraint = cp2k_dft_qs_cdft_hirshfeld_constraint()
self.outer_scf = cp2k_dft_qs_cdft_outer_scf()
# basic setting
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&CDFT\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.hirshfeld_constraint.status == True:
self.hirshfeld_constraint.to_input(fout)
if self.outer_scf.status == True:
self.outer_scf.to_input(fout)
fout.write("\t\t\t&END CDFT\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[3] == "HIRSHFELD_CONSTRAINT":
self.hirshfeld_constraint.set_params({item: params[item]})
elif item.split("-")[3] == "OUTER_SCF":
self.outer_scf.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_ddapc_restraint_program_run_info_each:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t&EACH\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t\t&END EACH\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 6:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_ddapc_restraint_program_run_info:
def __init__(self):
self.params = {
}
self.status = False
self.section = "LOW"
self.each = cp2k_dft_qs_ddapc_restraint_program_run_info_each()
# basic setting
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&PROGRAM_RUN_INFO\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.each.statu == True:
self.each.to_input(fout)
fout.write("\t\t\t\t&END PROGRAM_RUN_INFO\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[4] == "EACH":
self.each.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_ddapc_restraint:
def __init__(self):
self.params = {
}
self.status = False
self.program_run_info = cp2k_dft_qs_ddapc_restraint_program_run_info()
# basic setting
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&DDAPC_RESTRAINT\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.program_run_info.status == True:
self.program_run_info.to_input(fout)
fout.write("\t\t\t&END DDAPC_RESTRAINT\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
if item.split("-")[-1] == "PROGRAM_RUN_INFO":
self.program_run_info.section = params[item]
else:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[3] == "PROGRAM_RUN_INFO":
self.program_run_info.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_dftb_parameter:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&PARAMETER\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END PARAMETER\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_dftb:
def __init__(self):
self.params = {
}
self.status = False
self.parameter = cp2k_dft_qs_dftb_parameter()
# basic setting
self.parameter.status = True
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&DFTB\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.parameter.status == True:
self.parameter.to_input(fout)
fout.write("\t\t\t&END DFTB\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[3] == "PARAMETER":
self.parameter.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_distribution:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&DISTRIBUTION\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t&END DISTRIBUTION\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_lrigpw:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&LRIGPW\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t&END LRIGPW\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_mulliken_restraint:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&MULLIKEN_RESTRAINT\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t&END MULLIKEN_RESTRAINT\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_optimize_lri_basis_constraint_exponents:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&CONSTRAINT_EXPONENTS\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END CONSTRAINT_EXPONENTS\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_optimize_lri_basis:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&OPTIMIZE_LRI_BASIS\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t&END OPTIMIZE_LRI_BASIS\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_opt_embed_embed_dens_diff_each:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t&EACH\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t\t&END EACH\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 6:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_opt_embed_embed_dens_diff:
def __init__(self):
self.params = {
}
self.status = False
self.each = cp2k_dft_qs_opt_embed_embed_dens_diff_each()
# basic setting
self.each.status = True
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&EMBED_DENS_DIFF\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.each.status == True:
self.each.to_input(fout)
fout.write("\t\t\t\t&END EMBED_DENS_DIFF\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[4] == "EACH":
self.each.to_input(fout)
else:
pass
class cp2k_dft_qs_opt_embed_embed_pot_cube_each:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t&EACH\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t\t&END EACH\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 6:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_opt_embed_embed_pot_cube:
def __init__(self):
self.params = {
}
self.status = False
self.each = cp2k_dft_qs_opt_embed_embed_pot_cube_each()
# basic setting
self.each.status = True
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&EMBED_POT_CUBE\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.each.status == True:
self.each.to_input(fout)
fout.write("\t\t\t\t&END EMBED_POT_CUBE\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[4] == "EACH":
self.each.to_input(fout)
else:
pass
class cp2k_dft_qs_opt_embed_embed_pot_vector_each:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t&EACH\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t\t&END EACH\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 6:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_opt_embed_embed_pot_vector:
def __init__(self):
self.params = {
}
self.status = False
self.each = cp2k_dft_qs_opt_embed_embed_pot_vector_each()
# basic setting
self.each.status = True
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&EMBED_POT_VECTOR\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.each.status == True:
self.each.to_input(fout)
fout.write("\t\t\t\t&END EMBED_POT_VECTOR\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[4] == "EACH":
self.each.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_opt_embed:
def __init__(self):
self.params = {
}
self.status = False
self.embed_dens_diff = cp2k_dft_qs_opt_embed_embed_dens_diff()
self.embed_pot_cube = cp2k_dft_qs_opt_embed_embed_pot_cube()
self.embed_pot_vector = cp2k_dft_qs_opt_embed_embed_pot_vector()
# basic setting
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&OPT_EMBED\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.embed_dens_diff.status == True:
self.embed_dens_diff.to_input(fout)
if self.embed_pot_cube.status == True:
self.embed_pot_cube.to_input(fout)
if self.embed_pot_vector.status == True:
self.embed_pot_vector.to_input(fout)
fout.write("\t\t\t&END OPT_EMBED\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
if item.split("-")[-1] == "EMBED_DENS_DIFF":
self.embed_dens_diff.section = params[item]
elif item.split("-")[-1] == "EMBED_POT_CUBE":
self.embed_pot_cube.section = params[item]
elif item.split("-")[-1] == "EMBED_POT_VECTOR":
self.embed_pot_vector.section = params[item]
else:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[3] == "EMBED_DENS_DIFF":
self.embed_dens_diff.set_params({item: params[item]})
elif item.split("-")[3] == "EMBED_POT_CUBE":
self.embed_pot_cube.set_params({item: params[item]})
elif item.split("-")[3] == "EMBED_POT_VECTOR":
self.embed_pot_vector.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_s2_restraint:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&S2_RESTRAINT\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t&END S2_RESTRAINT\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se_coulomb:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&COULOMB\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END COULOMB\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se_exchange:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&EXCHANGE\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END EXCHANGE\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se_ga:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&GA\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END GA\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se_lr_correction:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&LR_CORRECTION\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END LR_CORRECTION\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se_memory:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&MEMORY\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END MEMORY\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se_neighbor_lists:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&NEIGHBOR_LISTS\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END NEIGHBOR_LISTS\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se_print_ewald_info_each:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t\t&EACH\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t\t\t&END EACH\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 7:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se_print_ewald_info:
def __init__(self):
self.params = {
}
self.status = False
self.each = cp2k_dft_qs_se_print_ewald_info_each()
# basic seting
self.each.status = True
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t&EWALD_INFO\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.each.status == True:
self.each.to_input(fout)
fout.write("\t\t\t\t\t&END EWALD_INFO\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 6:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[5] == "EACH":
self.each.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_se_print_neighbor_lists_each:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t\t&EACH\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t\t\t&END EACH\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 7:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se_print_neighbor_lists:
def __init__(self):
self.params = {
}
self.status = False
self.each = cp2k_dft_qs_se_print_neighbor_lists_each()
# basic seting
self.each.status = True
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t&NEIGHBOR_LISTS\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.each.status == True:
self.each.to_input(fout)
fout.write("\t\t\t\t\t&END NEIGHBOR_LISTS\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 6:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[5] == "EACH":
self.each.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_se_print_subcell_each:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t\t&EACH\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t\t\t&END EACH\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 7:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se_print_subcell:
def __init__(self):
self.params = {
}
self.status = False
self.each = cp2k_dft_qs_se_print_subcell_each()
# basic setting
self.each.status = True
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t\t&SUBCELL\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.each.status == True:
self.each.to_input(fout)
fout.write("\t\t\t\t\t&END SUBCELL\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 6:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[5] == "EACH":
self.each.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_se_print:
def __init__(self):
self.params = {
}
self.status = False
self.ewald_info = cp2k_dft_qs_se_print_ewald_info()
self.neighbor_lists = cp2k_dft_qs_se_print_neighbor_lists()
self.subcell = cp2k_dft_qs_se_print_subcell()
# basic setting
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&PRINT\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.ewald_info.status == True:
self.ewald_info.to_input(fout)
if self.neighbor_lists.status == True:
self.neighbor_lists.to_input(fout)
if self.subcell.status == True:
self.subcell.to_input(fout)
fout.write("\t\t\t\t&END PRINT\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[4] == "EWALD_INFO":
self.ewald_info.set_params({item: params[item]})
elif item.split("-")[4] == "NEIGHBOR_LISTS":
self.neighbor_lists.set_params({item: params[item]})
elif item.split("-")[4] == "SUBCELL":
self.subcell.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs_se_screening:
def __init__(self):
self.params = {
}
self.status = False
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t\t&SCREENING\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t\t%s %s\n" % (item, str(self.params[item])))
fout.write("\t\t\t\t&END SCREENING\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 5:
self.params[item.split("-")[-1]] = params[item]
else:
pass
class cp2k_dft_qs_se:
def __init__(self):
self.params = {
}
self.status = False
self.coulomb = cp2k_dft_qs_se_coulomb()
self.exchange = cp2k_dft_qs_se_exchange()
self.ga = cp2k_dft_qs_se_ga()
self.lr_correction = cp2k_dft_qs_se_lr_correction()
self.memory = cp2k_dft_qs_se_memory()
self.neighbor_lists = cp2k_dft_qs_se_neighbor_lists()
self.printout = cp2k_dft_qs_se_print()
self.screening = cp2k_dft_qs_se_screening()
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t\t&SE\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.coulomb.status == True:
self.coulomb.to_input(fout)
if self.exchange.status == True:
self.exchange.to_input(fout)
if self.ga.status == True:
self.ga.to_input(fout)
if self.lr_correction.status == True:
self.lr_correction.to_input(fout)
if self.memory.status == True:
self.memory.to_input(fout)
if self.neighbor_lists.status == True:
self.neighbor_lists.to_input(fout)
if self.printout.status == True:
self.printout.to_input(fout)
if self.screening.status == True:
self.screening.to_input(fout)
fout.write("\t\t\t&END SE\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 4:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[3] == "COULOMB":
self.coulomb.set_params({item: params[item]})
elif item.split("-")[3] == "EXCHANGE":
self.exchange.set_params({item: params[item]})
elif item.split("-")[3] == "GA":
self.ga.set_params({item: params[item]})
elif item.split("-")[3] == "LR_CORRECTION":
self.lr_correction.set_params({item: params[item]})
elif item.split("-")[3] == "MEMORY":
self.memory.set_params({item: params[item]})
elif item.split("-")[3] == "NEIGHBOR_LISTS":
self.neighbor_lists.set_params({item: params[item]})
elif item.split("-")[3] == "PRINT":
self.printout.set_params({item: params[item]})
elif item.split("-")[3] == "SCREENING":
self.screening.set_params({item: params[item]})
else:
pass
class cp2k_dft_qs:
def __init__(self):
self.params = {
"METHOD": "GPW",
"EPS_DEFAULT": 1.0E-14,
"FORCE_PAW": None,
}
self.status = False
self.becke_constraint = cp2k_dft_qs_becke_constraint()
self.cdft = cp2k_dft_qs_cdft()
self.ddapc_restraint = cp2k_dft_qs_ddapc_restraint()
self.dftb = cp2k_dft_qs_dftb()
self.distribution = cp2k_dft_qs_distribution()
self.lrigpw = cp2k_dft_qs_lrigpw()
self.mulliken_restraint = cp2k_dft_qs_mulliken_restraint()
self.optimize_lri_basis = cp2k_dft_qs_optimize_lri_basis()
self.opt_embed = cp2k_dft_qs_opt_embed()
self.s2_restraint = cp2k_dft_qs_s2_restraint()
self.se = cp2k_dft_qs_se()
def to_input(self, fout):
"""
fout: a file stream for writing
"""
fout.write("\t\t&QS\n")
for item in self.params:
if self.params[item] is not None:
fout.write("\t\t\t%s %s\n" % (item, str(self.params[item])))
if self.becke_constraint.status == True:
self.becke_constraint.to_input(fout)
if self.cdft.status == True:
self.cdft.to_input(fout)
if self.ddapc_restraint.status == True:
self.ddapc_restraint.to_input(fout)
if self.dftb.status == True:
self.dftb.to_input(fout)
if self.distribution.status == True:
self.distribution.to_input(fout)
if self.lrigpw.status == True:
self.lrigpw.to_input(fout)
if self.mulliken_restraint.status == True:
self.mulliken_restraint.to_input(fout)
if self.optimize_lri_basis.status == True:
self.optimize_lri_basis.to_input(fout)
if self.opt_embed.status == True:
self.opt_embed.to_input(fout)
if self.s2_restraint.status == True:
self.s2_restraint.to_input(fout)
if self.se.status == True:
self.se.to_input(fout)
fout.write("\t\t&END QS\n")
def set_params(self, params):
for item in params:
if len(item.split("-")) == 3:
self.params[item.split("-")[-1]] = params[item]
elif item.split("-")[2] == "BECKE_CONSTRAINT":
self.becke_constraint.set_params({item: params[item]})
elif item.split("-")[2] == "CDFT":
self.cdft.set_params({item: params[item]})
elif item.split("-")[2] == "DDAPC_RESTRAINT":
sel.fddapc_restraint.set_params({item: params[item]})
elif item.split("-")[2] == "DFTB":
self.dftb.set_params({item: params[item]})
elif item.split("-")[2] == "DISTRIBUTION":
self.distribution.set_params({item: params[item]})
elif item.split("-")[2] == "LRIGPW":
self.lrigpw.set_params({item: params[item]})
elif item.split("-")[2] == "MULLIKEN_RESTRAINT":
self.mulliken_restraint.set_params({item: params[item]})
elif item.split("-")[2] == "OPTIMIZE_LRI_BASIS":
self.optimize_lri_basis.set_params({item: params[item]})
elif item.split("-")[2] == "OPT_EMBED":
self.opt_embed.set_params({item: params[item]})
elif item.split("-")[2] == "S2_RESTRAINT":
self.s2_restraint.set_params({item: params[item]})
elif item.split("-")[2] == "SE":
self.se.set_params({item: params[item]})
else:
pass
| 33.057875
| 89
| 0.507291
| 5,823
| 45,124
| 3.749442
| 0.019921
| 0.038382
| 0.039024
| 0.027665
| 0.889708
| 0.863464
| 0.848257
| 0.824577
| 0.817203
| 0.762195
| 0
| 0.008221
| 0.353005
| 45,124
| 1,364
| 90
| 33.082111
| 0.739613
| 0.039691
| 0
| 0.663673
| 0
| 0
| 0.082349
| 0.014055
| 0
| 0
| 0
| 0
| 0
| 1
| 0.134731
| false
| 0.04491
| 0
| 0
| 0.179641
| 0.016966
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
49962c3444128d6621caec65d1bc0622026f4654
| 8,856
|
py
|
Python
|
test/test_beam_search.py
|
isl-mt/xnmt-isl
|
0f25c8f7f90cd5fa39de03302219a66d640a44f0
|
[
"Apache-2.0"
] | 4
|
2020-07-20T08:53:32.000Z
|
2020-11-25T21:21:23.000Z
|
test/test_beam_search.py
|
isl-mt/xnmt-isl
|
0f25c8f7f90cd5fa39de03302219a66d640a44f0
|
[
"Apache-2.0"
] | null | null | null |
test/test_beam_search.py
|
isl-mt/xnmt-isl
|
0f25c8f7f90cd5fa39de03302219a66d640a44f0
|
[
"Apache-2.0"
] | 1
|
2020-09-04T07:19:10.000Z
|
2020-09-04T07:19:10.000Z
|
import unittest
import dynet as dy
from xnmt.modelparts.attenders import MlpAttender
from xnmt import batchers, event_trigger, events
from xnmt.modelparts.bridges import CopyBridge
from xnmt.modelparts.decoders import AutoRegressiveDecoder
from xnmt.modelparts.embedders import SimpleWordEmbedder
from xnmt.input_readers import PlainTextReader
from xnmt.transducers.recurrent import UniLSTMSeqTransducer, BiLSTMSeqTransducer
from xnmt.loss_calculators import MLELoss
from xnmt.modelparts.transforms import NonLinear
from xnmt.modelparts.scorers import Softmax
from xnmt.models.translators import DefaultTranslator
from xnmt.search_strategies import BeamSearch, GreedySearch
from xnmt.param_collections import ParamManager
from xnmt.vocabs import Vocab
class TestForcedDecodingOutputs(unittest.TestCase):
def assertItemsEqual(self, l1, l2):
self.assertEqual(len(l1), len(l2))
for i in range(len(l1)):
self.assertEqual(l1[i], l2[i])
def setUp(self):
layer_dim = 512
events.clear()
ParamManager.init_param_col()
src_vocab = Vocab(vocab_file="examples/data/head.ja.vocab")
trg_vocab = Vocab(vocab_file="examples/data/head.en.vocab")
self.model = DefaultTranslator(
src_reader=PlainTextReader(vocab=src_vocab),
trg_reader=PlainTextReader(vocab=trg_vocab),
src_embedder=SimpleWordEmbedder(emb_dim=layer_dim, vocab_size=100),
encoder=BiLSTMSeqTransducer(input_dim=layer_dim, hidden_dim=layer_dim),
attender=MlpAttender(input_dim=layer_dim, state_dim=layer_dim, hidden_dim=layer_dim),
trg_embedder=SimpleWordEmbedder(emb_dim=layer_dim, vocab_size=100),
decoder=AutoRegressiveDecoder(input_dim=layer_dim,
trg_embed_dim=layer_dim,
rnn=UniLSTMSeqTransducer(input_dim=layer_dim, hidden_dim=layer_dim, decoder_input_dim=layer_dim, yaml_path="model.decoder.rnn"),
transform=NonLinear(input_dim=layer_dim*2, output_dim=layer_dim),
scorer=Softmax(input_dim=layer_dim, vocab_size=100),
bridge=CopyBridge(dec_dim=layer_dim, dec_layers=1)),
)
event_trigger.set_train(False)
self.src_data = list(self.model.src_reader.read_sents("examples/data/head.ja"))
self.trg_data = list(self.model.trg_reader.read_sents("examples/data/head.en"))
def assert_forced_decoding(self, sent_id):
dy.renew_cg()
outputs = self.model.generate(batchers.mark_as_batch([self.src_data[sent_id]]), BeamSearch(),
forced_trg_ids=batchers.mark_as_batch([self.trg_data[sent_id]]))
self.assertItemsEqual(self.trg_data[sent_id].words, outputs[0].words)
def test_forced_decoding(self):
for i in range(1):
self.assert_forced_decoding(sent_id=i)
class TestForcedDecodingLoss(unittest.TestCase):
def setUp(self):
layer_dim = 512
events.clear()
ParamManager.init_param_col()
src_vocab = Vocab(vocab_file="examples/data/head.ja.vocab")
trg_vocab = Vocab(vocab_file="examples/data/head.en.vocab")
self.model = DefaultTranslator(
src_reader=PlainTextReader(vocab=src_vocab),
trg_reader=PlainTextReader(vocab=trg_vocab),
src_embedder=SimpleWordEmbedder(emb_dim=layer_dim, vocab_size=100),
encoder=BiLSTMSeqTransducer(input_dim=layer_dim, hidden_dim=layer_dim),
attender=MlpAttender(input_dim=layer_dim, state_dim=layer_dim, hidden_dim=layer_dim),
trg_embedder=SimpleWordEmbedder(emb_dim=layer_dim, vocab_size=100),
decoder=AutoRegressiveDecoder(input_dim=layer_dim,
trg_embed_dim=layer_dim,
rnn=UniLSTMSeqTransducer(input_dim=layer_dim, hidden_dim=layer_dim, decoder_input_dim=layer_dim, yaml_path="model.decoder.rnn"),
transform=NonLinear(input_dim=layer_dim*2, output_dim=layer_dim),
scorer=Softmax(input_dim=layer_dim, vocab_size=100),
bridge=CopyBridge(dec_dim=layer_dim, dec_layers=1)),
)
event_trigger.set_train(False)
self.src_data = list(self.model.src_reader.read_sents("examples/data/head.ja"))
self.trg_data = list(self.model.trg_reader.read_sents("examples/data/head.en"))
def test_single(self):
dy.renew_cg()
train_loss = self.model.calc_nll(src=self.src_data[0],
trg=self.trg_data[0]).value()
dy.renew_cg()
outputs = self.model.generate(batchers.mark_as_batch([self.src_data[0]]), BeamSearch(beam_size=1),
forced_trg_ids=batchers.mark_as_batch([self.trg_data[0]]))
self.assertAlmostEqual(-outputs[0].score, train_loss, places=4)
class TestFreeDecodingLoss(unittest.TestCase):
def setUp(self):
layer_dim = 512
events.clear()
ParamManager.init_param_col()
src_vocab = Vocab(vocab_file="examples/data/head.ja.vocab")
trg_vocab = Vocab(vocab_file="examples/data/head.en.vocab")
self.model = DefaultTranslator(
src_reader=PlainTextReader(vocab=src_vocab),
trg_reader=PlainTextReader(vocab=trg_vocab),
src_embedder=SimpleWordEmbedder(emb_dim=layer_dim, vocab_size=100),
encoder=BiLSTMSeqTransducer(input_dim=layer_dim, hidden_dim=layer_dim),
attender=MlpAttender(input_dim=layer_dim, state_dim=layer_dim, hidden_dim=layer_dim),
trg_embedder=SimpleWordEmbedder(emb_dim=layer_dim, vocab_size=100),
decoder=AutoRegressiveDecoder(input_dim=layer_dim,
trg_embed_dim=layer_dim,
rnn=UniLSTMSeqTransducer(input_dim=layer_dim, hidden_dim=layer_dim, decoder_input_dim=layer_dim, yaml_path="model.decoder.rnn"),
transform=NonLinear(input_dim=layer_dim*2, output_dim=layer_dim),
scorer=Softmax(input_dim=layer_dim, vocab_size=100),
bridge=CopyBridge(dec_dim=layer_dim, dec_layers=1)),
)
event_trigger.set_train(False)
self.src_data = list(self.model.src_reader.read_sents("examples/data/head.ja"))
self.trg_data = list(self.model.trg_reader.read_sents("examples/data/head.en"))
def test_single(self):
dy.renew_cg()
outputs = self.model.generate(batchers.mark_as_batch([self.src_data[0]]), BeamSearch(),
forced_trg_ids=batchers.mark_as_batch([self.trg_data[0]]))
dy.renew_cg()
train_loss = self.model.calc_nll(src=self.src_data[0],
trg=outputs[0]).value()
self.assertAlmostEqual(-outputs[0].score, train_loss, places=4)
class TestGreedyVsBeam(unittest.TestCase):
"""
Test if greedy search produces same output as beam search with beam 1.
"""
def setUp(self):
layer_dim = 512
events.clear()
ParamManager.init_param_col()
src_vocab = Vocab(vocab_file="examples/data/head.ja.vocab")
trg_vocab = Vocab(vocab_file="examples/data/head.en.vocab")
self.model = DefaultTranslator(
src_reader=PlainTextReader(vocab=src_vocab),
trg_reader=PlainTextReader(vocab=trg_vocab),
src_embedder=SimpleWordEmbedder(emb_dim=layer_dim, vocab_size=100),
encoder=BiLSTMSeqTransducer(input_dim=layer_dim, hidden_dim=layer_dim),
attender=MlpAttender(input_dim=layer_dim, state_dim=layer_dim, hidden_dim=layer_dim),
trg_embedder=SimpleWordEmbedder(emb_dim=layer_dim, vocab_size=100),
decoder=AutoRegressiveDecoder(input_dim=layer_dim,
trg_embed_dim=layer_dim,
rnn=UniLSTMSeqTransducer(input_dim=layer_dim, hidden_dim=layer_dim, decoder_input_dim=layer_dim, yaml_path="model.decoder.rnn"),
transform=NonLinear(input_dim=layer_dim*2, output_dim=layer_dim),
scorer=Softmax(input_dim=layer_dim, vocab_size=100),
bridge=CopyBridge(dec_dim=layer_dim, dec_layers=1)),
)
event_trigger.set_train(False)
self.src_data = list(self.model.src_reader.read_sents("examples/data/head.ja"))
self.trg_data = list(self.model.trg_reader.read_sents("examples/data/head.en"))
def test_greedy_vs_beam(self):
dy.renew_cg()
outputs = self.model.generate(batchers.mark_as_batch([self.src_data[0]]), BeamSearch(beam_size=1),
forced_trg_ids=batchers.mark_as_batch([self.trg_data[0]]))
output_score1 = outputs[0].score
dy.renew_cg()
outputs = self.model.generate(batchers.mark_as_batch([self.src_data[0]]), GreedySearch(),
forced_trg_ids=batchers.mark_as_batch([self.trg_data[0]]))
output_score2 = outputs[0].score
self.assertAlmostEqual(output_score1, output_score2)
if __name__ == '__main__':
unittest.main()
| 49.2
| 160
| 0.699187
| 1,149
| 8,856
| 5.100087
| 0.122715
| 0.092833
| 0.120137
| 0.076451
| 0.790444
| 0.786519
| 0.786519
| 0.786519
| 0.786519
| 0.786519
| 0
| 0.012637
| 0.195799
| 8,856
| 179
| 161
| 49.47486
| 0.810166
| 0.007904
| 0
| 0.703947
| 0
| 0
| 0.052428
| 0.043766
| 0
| 0
| 0
| 0
| 0.059211
| 1
| 0.065789
| false
| 0
| 0.105263
| 0
| 0.197368
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
77189984772302ccdb12bf55b593ebd933e3f408
| 19,743
|
py
|
Python
|
tests/test_rules.py
|
zaibacu/rita-dsl
|
aea496ac1bc870646d12086d220eb216960d78f6
|
[
"MIT"
] | 66
|
2019-07-17T05:23:04.000Z
|
2022-03-15T12:06:06.000Z
|
tests/test_rules.py
|
zaibacu/rita-dsl
|
aea496ac1bc870646d12086d220eb216960d78f6
|
[
"MIT"
] | 90
|
2019-07-18T10:21:13.000Z
|
2021-11-09T19:54:57.000Z
|
tests/test_rules.py
|
zaibacu/rita-dsl
|
aea496ac1bc870646d12086d220eb216960d78f6
|
[
"MIT"
] | 3
|
2020-08-20T06:57:11.000Z
|
2022-03-03T16:11:45.000Z
|
import os.path
import re
import tempfile
import pytest
import rita
class TestSpacy(object):
@property
def punct(self):
return {'IS_PUNCT': True, 'OP': '?'}
def compiler(self, rules):
pytest.importorskip("spacy", minversion="2.1")
return rita.compile_string(rules, use_engine="spacy")
def test_punct(self):
rules = self.compiler('PUNCT->MARK("SOME_PUNCT")')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"pattern": [{"IS_PUNCT": True}],
"label": "SOME_PUNCT"
}
def test_number(self):
rules = self.compiler('NUM("42")->MARK("SOME_NUMBER")')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"pattern": [{"LOWER": "42"}],
"label": "SOME_NUMBER"
}
def test_pos(self):
rules = self.compiler('POS("VERB")->MARK("SOME_POS")')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"pattern": [{"POS": "VERB"}],
"label": "SOME_POS"
}
def test_single_word(self):
rules = self.compiler('WORD("Test")->MARK("SOME_LABEL")')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"pattern": [{"LOWER": "test"}],
"label": "SOME_LABEL"
}
def test_multiple_words(self):
rules = self.compiler('''
words = {"test1", "test2"}
IN_LIST(words)->MARK("MULTI_LABEL")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"pattern": [{"LOWER": {"REGEX": "^(test1|test2)$"}}],
"label": "MULTI_LABEL"
}
def test_simple_pattern(self):
rules = self.compiler('''
{WORD("test1"), WORD("test2")}->MARK("SIMPLE_PATTERN")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"pattern": [{"LOWER": "test1"}, self.punct, {"LOWER": "test2"}],
"label": "SIMPLE_PATTERN"
}
def test_or_branch(self):
rules = self.compiler('''
{WORD("test1")|WORD("test2")}->MARK("SPLIT_LABEL")
''')
print(rules)
assert len(rules) == 2
assert rules[0] == {
"pattern": [{"LOWER": "test1"}],
"label": "SPLIT_LABEL"
}
assert rules[1] == {
"pattern": [{"LOWER": "test2"}],
"label": "SPLIT_LABEL"
}
def test_or_branch_multi(self):
rules = self.compiler('''
{WORD("test1")|WORD("test2"),WORD("test3")|WORD("test4")}->MARK("MULTI_SPLIT_LABEL")
''')
print(rules)
assert len(rules) == 4
assert rules[0] == {
"pattern": [{"LOWER": "test1"}, self.punct, {"LOWER": "test3"}],
"label": "MULTI_SPLIT_LABEL"
}
assert rules[1] == {
"pattern": [{"LOWER": "test2"}, self.punct, {"LOWER": "test3"}],
"label": "MULTI_SPLIT_LABEL"
}
assert rules[2] == {
"pattern": [{"LOWER": "test1"}, self.punct, {"LOWER": "test4"}],
"label": "MULTI_SPLIT_LABEL"
}
assert rules[3] == {
"pattern": [{"LOWER": "test2"}, self.punct, {"LOWER": "test4"}],
"label": "MULTI_SPLIT_LABEL"
}
def test_or_branch_multi_w_single(self):
rules = self.compiler('''
numbers={"one", "two", "three"}
{WORD("test1")|WORD("test2"),IN_LIST(numbers),WORD("test3")|WORD("test4")}->MARK("MULTI_SPLIT_LABEL")
''')
print(rules)
assert len(rules) == 4
list_items = {"LOWER": {"REGEX": "^(one|three|two)$"}}
assert rules[0] == {
"pattern": [{"LOWER": "test1"}, self.punct, list_items, self.punct, {"LOWER": "test3"}],
"label": "MULTI_SPLIT_LABEL"
}
assert rules[1] == {
"pattern": [{"LOWER": "test2"}, self.punct, list_items, self.punct, {"LOWER": "test3"}], "label": "MULTI_SPLIT_LABEL"}
assert rules[2] == {
"pattern": [{"LOWER": "test1"}, self.punct, list_items, self.punct, {"LOWER": "test4"}],
"label": "MULTI_SPLIT_LABEL"
}
assert rules[3] == {
"pattern": [{"LOWER": "test2"}, self.punct, list_items, self.punct, {"LOWER": "test4"}],
"label": "MULTI_SPLIT_LABEL"
}
def test_branching_list(self):
rules = self.compiler('''
items={"test1", "test2", "test-3", "test4"}
{IN_LIST(items)}->MARK("SPLIT_LIST")
''')
print(rules)
assert len(rules) == 2
assert rules[0] == {
"label": "SPLIT_LIST",
"pattern": [{"LOWER": {"REGEX": "^(test1|test2|test4)$"}}]
}
assert rules[1] == {
"label": "SPLIT_LIST",
"pattern": [{"LOWER": "test"}, {"LOWER": "-"}, {"LOWER": "3"}]
}
def test_double_branching_list(self):
rules = self.compiler('''
items={"test1", "test2", "test-3", "test4", "test-5"}
{IN_LIST(items)}->MARK("SPLIT_LIST")
''')
print(rules)
assert len(rules) == 3
assert rules[0] == {
"label": "SPLIT_LIST",
"pattern": [{"LOWER": {"REGEX": "^(test1|test2|test4)$"}}]
}
assert rules[1] == {
"label": "SPLIT_LIST",
"pattern": [{"LOWER": "test"}, {"LOWER": "-"}, {"LOWER": "3"}]
}
assert rules[2] == {
"label": "SPLIT_LIST",
"pattern": [{"LOWER": "test"}, {"LOWER": "-"}, {"LOWER": "5"}]
}
def test_word_with_spaces(self):
rules = self.compiler('''
WORD("test1 test2")->MARK("SPLIT_WORD")
''')
print(rules)
# It should be split into two: WORD("test1"), WORD("test2")
assert len(rules) == 1
assert rules[0] == {
"label": "SPLIT_WORD",
"pattern": [{"LOWER": "test1"}, {"LOWER": "test2"}]
}
def test_word_with_dash(self):
rules = self.compiler('''
WORD("test1-test2")->MARK("SPLIT_WORD")
''')
print(rules)
# It should be split into two: WORD("test1"), WORD("test2")
assert len(rules) == 1
assert rules[0] == {
"label": "SPLIT_WORD",
"pattern": [{"LOWER": "test1"}, {"LOWER": "-"}, {"LOWER": "test2"}]
}
def test_word_with_accent(self):
rules = self.compiler('''
WORD("Šarūnas")->MARK("TWO_WORDS")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"label": "TWO_WORDS",
"pattern": [{"LOWER": {"REGEX": "^(sarunas|šarūnas)$"}}]
}
def test_list_with_accent(self):
rules = self.compiler('''
names={"Jonas", "Jurgis", "Šarūnas"}
IN_LIST(names)->MARK("EXTENDED_LIST")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"label": "EXTENDED_LIST",
"pattern": [{"LOWER": {"REGEX": "^(jonas|jurgis|sarunas|šarūnas)$"}}]
}
def test_prefix_on_word(self):
rules = self.compiler('''
{PREFIX("meta"), WORD("physics")}->MARK("META_WORD")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"label": "META_WORD",
"pattern": [{"LOWER": "metaphysics"}]
}
def test_prefix_on_list(self):
rules = self.compiler('''
science = {"physics", "mathematics"}
{PREFIX("meta"), IN_LIST(science)}->MARK("META_LIST")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"label": "META_LIST",
"pattern": [{"LOWER": {"REGEX": "^(metamathematics|metaphysics)$"}}]
}
def test_prefix_on_unknown_type(self):
rules = self.compiler('''
{PREFIX("test"), ANY}->MARK("NOT_VALID")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == {
"label": "NOT_VALID",
"pattern": [{}]
}
def test_multiple_optionals(self):
rules = self.compiler("""
{NUM+, WORD("-")?, NUM?, WORD("/")?, NUM?}->MARK("NUMBER_PATTERN")
""")
print(rules)
assert len(rules) == 1
assert rules[0] == {
"label": "NUMBER_PATTERN",
"pattern": [
{"LOWER": {"REGEX": "((\\d+[\\.,]\\d+)|(\\d+))"}, "OP": "+"},
{"IS_PUNCT": True, "OP": "?"},
{"LOWER": "-", "OP": "?"},
{"IS_PUNCT": True, "OP": "?"},
{"LOWER": {"REGEX": "((\\d+[\\.,]\\d+)|(\\d+))"}, "OP": "?"},
{"IS_PUNCT": True, "OP": "?"},
{"LOWER": "/", "OP": "?"},
{"IS_PUNCT": True, "OP": "?"},
{"LOWER": {"REGEX": "((\\d+[\\.,]\\d+)|(\\d+))"}, "OP": "?"},
]
}
def test_optional_list(self):
rules = self.compiler("""
elements = {"one", "two"}
{IN_LIST(elements)?}->MARK("OPTIONAL_LIST")
""")
print(rules)
assert len(rules) == 1
assert rules[0] == {
"label": "OPTIONAL_LIST",
"pattern": [{"LOWER": {"REGEX": "^(one|two)$"}, "OP": "?"}]
}
def test_tag_module(self):
rules = self.compiler("""
!IMPORT("rita.modules.tag")
TAG("^NN|^JJ")->MARK("TEST_TAG")
""")
print(rules)
assert len(rules) == 1
assert rules[0] == {
"label": "TEST_TAG",
"pattern": [{"TAG": {"REGEX": "^NN|^JJ"}}]
}
def test_tag_word(self):
rules = self.compiler("""
!IMPORT("rita.modules.tag")
TAG_WORD("^VB", "proposed")->MARK("TEST_TAG")
""")
print(rules)
assert len(rules) == 1
assert rules[0] == {
"label": "TEST_TAG",
"pattern": [{"LOWER": "proposed", "TAG": {"REGEX": "^VB"}}]
}
def test_tag_list(self):
rules = self.compiler("""
!IMPORT("rita.modules.tag")
words = {"perceived", "proposed"}
{TAG_WORD("^VB", words)}->MARK("TEST_TAG")
""")
print(rules)
assert len(rules) == 1
assert rules[0] == {
"label": "TEST_TAG",
"pattern": [{"LOWER": {"REGEX": "^(perceived|proposed)$"}, "TAG": {"REGEX": "^VB"}}]
}
def test_tags_case_sensitive(self):
rules = self.compiler("""
!CONFIG("ignore_case", "F")
!IMPORT("rita.modules.tag")
words = {"perceived", "proposed"}
TAG_WORD("^VB", "proposed")->MARK("TEST_TAG")
{TAG_WORD("^VB", words)}->MARK("TEST_TAG")
""")
print(rules)
assert len(rules) == 2
assert rules == [
{
"label": "TEST_TAG",
"pattern": [{"TEXT": "proposed", "TAG": {"REGEX": "^VB"}}]
},
{
"label": "TEST_TAG",
"pattern": [{"TEXT": {"REGEX": "^(perceived|proposed)$"}, "TAG": {"REGEX": "^VB"}}]
}
]
def test_generate_names(self):
rules = self.compiler("""
!IMPORT("rita.modules.names")
names = {"Roy Jones junior", "Roy Jones senior", "Juan-Claude van Damme", "Jon Jones"}
NAMES(names)->MARK("NAME_MATCH")
NAMES("Kazushi Sakuraba")->MARK("NAME_MATCH")
""")
print(rules)
assert len(rules) == 10
def test_any_tag(self):
rules = self.compiler("""
ANY -> MARK("ANYTHING_GOES_HERE")
""")
print(rules)
assert len(rules) == 1
assert rules == [{"label": "ANYTHING_GOES_HERE", "pattern": [{}]}]
class TestStandalone(object):
@property
def punct(self):
return re.compile(r"[.,!;?:]")
@property
def flags(self):
return re.DOTALL | re.IGNORECASE
def compiler(self, rules):
return rita.compile_string(rules, use_engine="standalone").patterns
def test_punct(self):
rules = self.compiler('PUNCT->MARK("SOME_PUNCT")')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(r"(?P<SOME_PUNCT>(?P<s0>([.,!;?:]\s?)))", self.flags)
def test_number(self):
rules = self.compiler('NUM("42")->MARK("SOME_NUMBER")')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(r"(?P<SOME_NUMBER>(?P<s0>(42\s?)))", self.flags)
def test_single_word(self):
rules = self.compiler('WORD("Test")->MARK("SOME_LABEL")')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(r"(?P<SOME_LABEL>(?P<s0>(Test\s?)))", self.flags)
def test_multiple_words(self):
rules = self.compiler('''
words = {"test1", "test2"}
IN_LIST(words)->MARK("MULTI_LABEL")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(r"(?P<MULTI_LABEL>(?P<s0>((^|\s)((test1|test2)\s?))))", self.flags)
def test_simple_pattern(self):
rules = self.compiler('''
{WORD("test1"), WORD("test2")}->MARK("SIMPLE_PATTERN")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(
r"(?P<SIMPLE_PATTERN>(?P<s0>(test1\s?))(?P<s1>([.,!;?:]\s?)?)(?P<s2>(test2\s?)))",
self.flags
)
def test_or_branch(self):
rules = self.compiler('''
{WORD("test1")|WORD("test2")}->MARK("SPLIT_LABEL")
''')
print(rules)
assert len(rules) == 2
assert rules[0] == re.compile(r"(?P<SPLIT_LABEL>(?P<s0>(test1\s?)))", self.flags)
assert rules[1] == re.compile(r"(?P<SPLIT_LABEL>(?P<s0>(test2\s?)))", self.flags)
def test_or_branch_multi(self):
rules = self.compiler('''
{WORD("test1")|WORD("test2"),WORD("test3")|WORD("test4")}->MARK("MULTI_SPLIT_LABEL")
''')
print(rules)
assert len(rules) == 4
assert rules[0] == re.compile(
r"(?P<MULTI_SPLIT_LABEL>(?P<s0>(test1\s?))(?P<s1>([.,!;?:]\s?)?)(?P<s2>(test3\s?)))",
self.flags
)
assert rules[1] == re.compile(
r"(?P<MULTI_SPLIT_LABEL>(?P<s0>(test2\s?))(?P<s1>([.,!;?:]\s?)?)(?P<s2>(test3\s?)))",
self.flags
)
assert rules[2] == re.compile(
r"(?P<MULTI_SPLIT_LABEL>(?P<s0>(test1\s?))(?P<s1>([.,!;?:]\s?)?)(?P<s2>(test4\s?)))",
self.flags
)
assert rules[3] == re.compile(
r"(?P<MULTI_SPLIT_LABEL>(?P<s0>(test2\s?))(?P<s1>([.,!;?:]\s?)?)(?P<s2>(test4\s?)))",
self.flags
)
def test_or_branch_multi_w_single(self):
rules = self.compiler('''
numbers={"one", "two", "three"}
{WORD("test1")|WORD("test2"),IN_LIST(numbers),WORD("test3")|WORD("test4")}->MARK("MULTI_SPLIT_LABEL")
''')
print(rules)
assert len(rules) == 4
assert rules[0] == re.compile(
r"(?P<MULTI_SPLIT_LABEL>(?P<s0>(test1\s?))(?P<s1>([.,!;?:]\s?)?)"
r"(?P<s2>((^|\s)((three|one|two)\s?)))(?P<s3>([.,!;?:]\s?)?)(?P<s4>(test3\s?)))",
self.flags
)
assert rules[1] == re.compile(
r"(?P<MULTI_SPLIT_LABEL>(?P<s0>(test2\s?))(?P<s1>([.,!;?:]\s?)?)"
r"(?P<s2>((^|\s)((three|one|two)\s?)))(?P<s3>([.,!;?:]\s?)?)(?P<s4>(test3\s?)))",
self.flags
)
assert rules[2] == re.compile(
r"(?P<MULTI_SPLIT_LABEL>(?P<s0>(test1\s?))(?P<s1>([.,!;?:]\s?)?)"
r"(?P<s2>((^|\s)((three|one|two)\s?)))(?P<s3>([.,!;?:]\s?)?)(?P<s4>(test4\s?)))",
self.flags
)
assert rules[3] == re.compile(
r"(?P<MULTI_SPLIT_LABEL>(?P<s0>(test2\s?))(?P<s1>([.,!;?:]\s?)?)"
r"(?P<s2>((^|\s)((three|one|two)\s?)))(?P<s3>([.,!;?:]\s?)?)(?P<s4>(test4\s?)))",
self.flags
)
def test_word_with_accent(self):
rules = self.compiler('''
WORD("Šarūnas")->MARK("TWO_WORDS")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(
r"(?P<TWO_WORDS>(?P<s0>((^|\s)((Sarunas|Šarūnas)\s?))))",
self.flags
)
def test_list_with_accent(self):
rules = self.compiler('''
names={"Jonas", "Jurgis", "Šarūnas"}
IN_LIST(names)->MARK("EXTENDED_LIST")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(
r"(?P<EXTENDED_LIST>(?P<s0>((^|\s)((Sarunas|Šarūnas|Jurgis|Jonas)\s?))))",
self.flags
)
def test_double_op(self):
rules = self.compiler('''
WORD+->MARK("DOUBLE_OP")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(
r"(?P<DOUBLE_OP>(?P<s0>(((\w|['_-])+)\s?)+))",
self.flags
)
def test_prefix_on_word(self):
rules = self.compiler('''
{PREFIX("meta"), WORD("physics")}->MARK("META_WORD")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(r"(?P<META_WORD>(?P<s0>(metaphysics\s?)))", self.flags)
def test_prefix_on_list(self):
rules = self.compiler('''
science = {"physics", "mathematics"}
{PREFIX("meta"), IN_LIST(science)}->MARK("META_LIST")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(
r"(?P<META_LIST>(?P<s0>((^|\s)((metamathematics|metaphysics)\s?))))",
self.flags
)
def test_prefix_on_unknown_type(self):
rules = self.compiler('''
{PREFIX("test"), ANY}->MARK("NOT_VALID")
''')
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(r"(?P<NOT_VALID>(?P<s0>(.*\s?)))", self.flags)
def test_save_and_load_rules_from_file(self):
rules = '''
{WORD("Hello"), WORD("world")}->MARK("HELLO")
'''
engine = rita.compile_string(rules, use_engine="standalone")
with tempfile.TemporaryDirectory() as tmpdir:
rules_path = os.path.join(tmpdir, "rules-example.json")
engine.save(rules_path)
engine.load(rules_path)
engine.execute("Hello world")
def test_optional_list(self):
rules = self.compiler("""
elements = {"one", "two"}
{IN_LIST(elements)?}->MARK("OPTIONAL_LIST")
""")
print(rules)
assert len(rules) == 1
assert rules[0] == re.compile(r"(?P<OPTIONAL_LIST>(?P<s0>((^|\s)((one|two)\s?))?))", self.flags)
def test_complex_list(self):
rules = self.compiler("""
fractions={"1 / 2", "3 / 4", "1 / 8", "3 / 8", "5 / 8", "7 / 8", "1 / 16", "3 / 16",
"5 / 16", "7 / 16", "9 / 16", "11 / 16", "13 / 16", "15 / 16", "1 / 32",
"3 / 32", "5 / 32", "7 / 32", "9 / 32", "11 / 32", "13 / 32", "15 / 32",
"17 / 32", "19 / 32", "21 / 32", "23 / 32", "25 / 32", "27 / 32",
"29 / 32", "31 / 32"}
{NUM+, WORD("-")?, IN_LIST(fractions)?}->MARK("COMPLEX_NUMBER")
""")
print(rules)
assert len(rules) == 1
def test_generate_names(self):
rules = self.compiler("""
!IMPORT("rita.modules.names")
names = {"Roy Jones junior", "Roy Jones senior", "Juan-Claude van Damme", "Jon Jones"}
NAMES(names)->MARK("NAME_MATCH")
NAMES("Kazushi Sakuraba")->MARK("NAME_MATCH")
""")
print(rules)
assert len(rules) == 2
| 32.579208
| 130
| 0.476625
| 2,168
| 19,743
| 4.2131
| 0.083487
| 0.068645
| 0.0612
| 0.098861
| 0.834684
| 0.805671
| 0.788483
| 0.761988
| 0.724217
| 0.70878
| 0
| 0.025958
| 0.303399
| 19,743
| 605
| 131
| 32.633058
| 0.638188
| 0.005825
| 0
| 0.667304
| 0
| 0.038241
| 0.389911
| 0.190115
| 0
| 0
| 0
| 0
| 0.191205
| 1
| 0.09369
| false
| 0
| 0.022945
| 0.007648
| 0.130019
| 0.082218
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
773114922f9d43539b6cd41def5d0bba0621825c
| 125
|
py
|
Python
|
lwrl/executions/__init__.py
|
sealday/lwrl
|
52bcd67751e605c38db4afa609c58938c7034e8d
|
[
"MIT"
] | 2
|
2019-04-11T11:55:48.000Z
|
2020-05-29T18:09:51.000Z
|
lwrl/executions/__init__.py
|
sealday/lwrl
|
52bcd67751e605c38db4afa609c58938c7034e8d
|
[
"MIT"
] | 6
|
2021-06-01T22:21:00.000Z
|
2022-03-11T23:24:36.000Z
|
lwrl/executions/__init__.py
|
sealday/lwrl
|
52bcd67751e605c38db4afa609c58938c7034e8d
|
[
"MIT"
] | 1
|
2019-04-12T03:09:47.000Z
|
2019-04-12T03:09:47.000Z
|
from lwrl.executions.runner import Runner
from lwrl.executions.threaded_runner import ThreadedRunner, threaded_agent_wrapper
| 41.666667
| 82
| 0.888
| 16
| 125
| 6.75
| 0.5625
| 0.148148
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.072
| 125
| 2
| 83
| 62.5
| 0.931034
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
91f26782088d79019bc4f02ecd720aa9fc815596
| 2,626
|
py
|
Python
|
Assembler/tests/test_labels_beta.py
|
Laegluin/mikrorechner
|
7e5e878072c941e422889465c43dea838b83e5fd
|
[
"MIT"
] | 1
|
2019-01-28T01:53:20.000Z
|
2019-01-28T01:53:20.000Z
|
Assembler/tests/test_labels_beta.py
|
Laegluin/mikrorechner
|
7e5e878072c941e422889465c43dea838b83e5fd
|
[
"MIT"
] | null | null | null |
Assembler/tests/test_labels_beta.py
|
Laegluin/mikrorechner
|
7e5e878072c941e422889465c43dea838b83e5fd
|
[
"MIT"
] | null | null | null |
from tests import test
import labels as lb
def test_is_datastring():
test.assertTrue(lb.is_datastring('0xFfA'))
test.assertTrue(lb.is_datastring('-123645'))
test.assertTrue(lb.is_datastring('235'))
test.assertTrue(lb.is_datastring('0b0101001'))
test.assertFalse(lb.is_datastring('0xFfg'))
test.assertFalse(lb.is_datastring('-0xFfA'))
test.assertFalse(lb.is_datastring('-0b1'))
test.assertFalse(lb.is_datastring(''))
def test_necessary_byte_storage():
test.assertEquals(lb.necessary_byte_storage('R4 = R5 + R6'), 4)
test.assertEquals(lb.necessary_byte_storage('\t'), 0)
test.assertEquals(lb.necessary_byte_storage('0xFFFFFF'), 3)
test.assertEquals(lb.necessary_byte_storage('0'), 1)
test.assertEquals(lb.necessary_byte_storage('256'), 2)
test.assertEquals(lb.necessary_byte_storage('255'), 1)
def test_cut_labels():
test.assertEquals(lb.cut_labels(['hallo welt _sdf']), ['hallo welt'])
test.assertEquals(lb.cut_labels(['hallo welt_sdf']), ['hallo welt_sdf'])
test.assertEquals(lb.cut_labels(['hallo_welt _sdf']), ['hallo_welt'])
test.assertEquals(lb.cut_labels(['hallo welt _sdf usw ']), ['hallo welt _sdf usw '])
test.assertEquals(lb.cut_labels(['hallo welt _??']), ['hallo welt _??'])
test.assertEquals(lb.cut_labels(['']), [''])
def test_cut_comments():
test.assertEquals(lb.cut_comments(['hallo welt _sdf #hier erst cutten']), ['hallo welt _sdf '])
test.assertEquals(lb.cut_comments(['hallo welt _sdf#hier erst cutten']), ['hallo welt _sdf'])
test.assertEquals(lb.cut_comments(['hallo welt #hier erst cutten _keine_labels_mitzählen']), ['hallo welt '])
test.assertEquals(lb.cut_comments(['#hallo welt _sdf #hier erst cutten']), [''])
def test_cut_whitespace_lines():
test.assertEquals(lb.cut_whitespace_lines(['']), [])
test.assertEquals(lb.cut_whitespace_lines(['\t', 'a']), ['a'])
test.assertEquals(lb.cut_whitespace_lines(['\n']), [])
test.assertEquals(lb.cut_whitespace_lines(['hallo', '', 'hallo']), ['hallo', 'hallo'])
def test_get_label_values_dictionary():
test.assertEquals(lb.get_label_values_dictionary(['R4 = R5 _label']), {'label': 'R4 = R5 '})
test.assertEquals(lb.get_label_values_dictionary(['R4 = R5 _label #hier nicht']), {})
test.assertEquals(lb.get_label_values_dictionary([' _label']), {'label': ' '})
test.assertEquals(lb.get_label_values_dictionary(['R4 = R5 _?']), {})
def test_all():
test_is_datastring()
test_necessary_byte_storage()
test_cut_labels()
test_cut_comments()
test_get_label_values_dictionary()
test_cut_whitespace_lines()
| 45.275862
| 113
| 0.706778
| 345
| 2,626
| 5.075362
| 0.15942
| 0.219303
| 0.246716
| 0.167904
| 0.81325
| 0.64763
| 0.436893
| 0.370074
| 0.370074
| 0.292404
| 0
| 0.020346
| 0.120335
| 2,626
| 57
| 114
| 46.070175
| 0.737662
| 0
| 0
| 0.042553
| 0
| 0
| 0.193979
| 0.008765
| 0
| 0
| 0.00686
| 0
| 0.680851
| 1
| 0.148936
| true
| 0
| 0.042553
| 0
| 0.191489
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
62435c05a8fb288e12cbddb9e71791c87559c07f
| 44
|
py
|
Python
|
pytoso/main.py
|
yc19890920/Learn
|
3990e75b469225ba7b430539ef9a16abe89eb863
|
[
"Apache-2.0"
] | 1
|
2021-01-11T06:30:44.000Z
|
2021-01-11T06:30:44.000Z
|
pytoso/main.py
|
yc19890920/Learn
|
3990e75b469225ba7b430539ef9a16abe89eb863
|
[
"Apache-2.0"
] | 23
|
2020-02-12T02:35:49.000Z
|
2022-02-11T03:45:40.000Z
|
pytoso/main.py
|
yc19890920/Learn
|
3990e75b469225ba7b430539ef9a16abe89eb863
|
[
"Apache-2.0"
] | 2
|
2020-04-08T15:39:46.000Z
|
2020-10-10T10:13:09.000Z
|
from ppp.utils import add
print(add(1, 3))
| 11
| 25
| 0.704545
| 9
| 44
| 3.444444
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.054054
| 0.159091
| 44
| 4
| 26
| 11
| 0.783784
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0.5
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
|
0
| 6
|
6264615defc693d7ec467590c14b66bfbc60a5a4
| 109
|
py
|
Python
|
main.py
|
david-fischer/Anki_CardGen
|
909d088ed4e98b97f65a2c896dc607941b00e4da
|
[
"MIT"
] | 2
|
2021-01-11T08:59:57.000Z
|
2021-02-01T12:15:30.000Z
|
main.py
|
david-fischer/Anki_CardGen
|
909d088ed4e98b97f65a2c896dc607941b00e4da
|
[
"MIT"
] | null | null | null |
main.py
|
david-fischer/Anki_CardGen
|
909d088ed4e98b97f65a2c896dc607941b00e4da
|
[
"MIT"
] | null | null | null |
from acg import BASE_PATH
from acg.main import main
from acg.utils import CD
with CD(BASE_PATH):
main()
| 15.571429
| 25
| 0.752294
| 20
| 109
| 4
| 0.45
| 0.2625
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.183486
| 109
| 6
| 26
| 18.166667
| 0.898876
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.6
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
02f561fca764c32764a026947f5e6eddb893cbd6
| 17
|
py
|
Python
|
tests/network/globals/test_functionalities.py
|
montefesp/REplan
|
e1eb0e80fa3c087e07f3d0c7601534aaf93ac7b7
|
[
"MIT"
] | 1
|
2021-12-10T14:13:37.000Z
|
2021-12-10T14:13:37.000Z
|
tests/network/globals/test_functionalities.py
|
montefesp/replan
|
e1eb0e80fa3c087e07f3d0c7601534aaf93ac7b7
|
[
"MIT"
] | null | null | null |
tests/network/globals/test_functionalities.py
|
montefesp/replan
|
e1eb0e80fa3c087e07f3d0c7601534aaf93ac7b7
|
[
"MIT"
] | null | null | null |
# TODO: complete
| 8.5
| 16
| 0.705882
| 2
| 17
| 6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.176471
| 17
| 1
| 17
| 17
| 0.857143
| 0.823529
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 1
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
f3234f246be60595a44143704dd5fefd8e30a384
| 42
|
py
|
Python
|
app/managers/__init__.py
|
actini/storage-manager
|
0f6995fe65e2ed8dd862ffd03b52c3808c0ff873
|
[
"MIT"
] | null | null | null |
app/managers/__init__.py
|
actini/storage-manager
|
0f6995fe65e2ed8dd862ffd03b52c3808c0ff873
|
[
"MIT"
] | null | null | null |
app/managers/__init__.py
|
actini/storage-manager
|
0f6995fe65e2ed8dd862ffd03b52c3808c0ff873
|
[
"MIT"
] | null | null | null |
from .mongodbmanager import MongoDBManager
| 42
| 42
| 0.904762
| 4
| 42
| 9.5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.071429
| 42
| 1
| 42
| 42
| 0.974359
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
b83796d331da10b07da497761a2b6f4cea0afc63
| 227
|
py
|
Python
|
python_modules/libraries/dagster-twilio/dagster_twilio/__init__.py
|
dbatten5/dagster
|
d76e50295054ffe5a72f9b292ef57febae499528
|
[
"Apache-2.0"
] | 4,606
|
2018-06-21T17:45:20.000Z
|
2022-03-31T23:39:42.000Z
|
python_modules/libraries/dagster-twilio/dagster_twilio/__init__.py
|
dbatten5/dagster
|
d76e50295054ffe5a72f9b292ef57febae499528
|
[
"Apache-2.0"
] | 6,221
|
2018-06-12T04:36:01.000Z
|
2022-03-31T21:43:05.000Z
|
python_modules/libraries/dagster-twilio/dagster_twilio/__init__.py
|
dbatten5/dagster
|
d76e50295054ffe5a72f9b292ef57febae499528
|
[
"Apache-2.0"
] | 619
|
2018-08-22T22:43:09.000Z
|
2022-03-31T22:48:06.000Z
|
from dagster.core.utils import check_dagster_package_version
from .resources import twilio_resource
from .version import __version__
check_dagster_package_version("dagster-twilio", __version__)
__all__ = ["twilio_resource"]
| 25.222222
| 60
| 0.845815
| 28
| 227
| 6.142857
| 0.428571
| 0.139535
| 0.22093
| 0.302326
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.088106
| 227
| 8
| 61
| 28.375
| 0.830918
| 0
| 0
| 0
| 0
| 0
| 0.127753
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.6
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
b85bd6c3d8e28dfb86e4de2d2882f26281c8fd69
| 4,789
|
py
|
Python
|
tests/test_gget_muscle.py
|
lauraluebbert/gget
|
43b24f46e910ee88af9b62f649d386cdfa3354b1
|
[
"MIT"
] | 3
|
2022-02-22T03:28:31.000Z
|
2022-03-01T23:30:33.000Z
|
tests/test_gget_muscle.py
|
lauraluebbert/gget
|
43b24f46e910ee88af9b62f649d386cdfa3354b1
|
[
"MIT"
] | null | null | null |
tests/test_gget_muscle.py
|
lauraluebbert/gget
|
43b24f46e910ee88af9b62f649d386cdfa3354b1
|
[
"MIT"
] | null | null | null |
import unittest
# Library to test functions that have calls to print()
from unittest import mock
import os
import contextlib
import filecmp
from gget.gget_muscle import muscle
class TestMuscle(unittest.TestCase):
def test_muscle_nt(self):
# File with sequences to align
fasta = "tests/fixtures/muscle_nt_test.fa"
# File the results will be saved in
out = "tests/fixtures/tmp.afa"
# Run muscle (trying to use contextlib here to silence muscle return (unsuccesfully))
with contextlib.redirect_stdout(open(os.devnull, "w")):
muscle(fasta, out=out)
# Expected result
ref_path = "tests/fixtures/muscle_nt_test.afa"
self.assertTrue(
filecmp.cmp(out, ref_path, shallow=False),
"The reference and muscle nucleotide alignment are not the same.",
)
def tearDown(self):
super(TestMuscle, self).tearDown()
# Delete temporary result file
os.remove("tests/fixtures/tmp.afa")
def test_muscle_nt_txt(self):
# File with sequences to align
fasta = "tests/fixtures/muscle_nt_test.txt"
# File the results will be saved in
out = "tests/fixtures/tmp.afa"
# Run muscle
with contextlib.redirect_stdout(open(os.devnull, "w")):
muscle(fasta, out=out)
# Expected result
ref_path = "tests/fixtures/muscle_nt_test.afa"
self.assertTrue(
filecmp.cmp(out, ref_path, shallow=False),
"The reference and muscle nucleotide alignment are not the same.",
)
def tearDown(self):
super(TestMuscle, self).tearDown()
# Delete temporary result file
os.remove("tests/fixtures/tmp.afa")
class TestMuscleSuper(unittest.TestCase):
def test_muscle_nt_super5(self):
# File with sequences to align
fasta = "tests/fixtures/muscle_nt_test.fa"
# File the results will be saved in
out = "tests/fixtures/tmp.afa"
# Run muscle
with contextlib.redirect_stdout(open(os.devnull, "w")):
muscle(fasta, out=out, super5=True)
# Expected result
ref_path = "tests/fixtures/muscle_super5_nt_test.afa"
self.assertTrue(
filecmp.cmp(out, ref_path, shallow=False),
"The reference and muscle super5 nucleotide alignment are not the same.",
)
def tearDown(self):
super(TestMuscleSuper, self).tearDown()
# Delete temporary result file
os.remove("tests/fixtures/tmp.afa")
class TestMuscleAA(unittest.TestCase):
def test_muscle_aa(self):
# File with sequences to align
fasta = "tests/fixtures/muscle_aa_test.fa"
# File the results will be saved in
out = "tests/fixtures/tmp.afa"
# Run muscle
with contextlib.redirect_stdout(open(os.devnull, "w")):
muscle(fasta, out=out)
# Expected result
ref_path = "tests/fixtures/muscle_aa_test.afa"
self.assertTrue(
filecmp.cmp(out, ref_path, shallow=False),
"The reference and muscle amino acid alignment are not the same.",
)
def tearDown(self):
super(TestMuscleAA, self).tearDown()
# Delete temporary result file
os.remove("tests/fixtures/tmp.afa")
class TestMuscleAASuper(unittest.TestCase):
def test_muscle_aa_super5(self):
# File with sequences to align
fasta = "tests/fixtures/muscle_aa_test.fa"
# File the results will be saved in
out = "tests/fixtures/tmp.afa"
# Run muscle
with contextlib.redirect_stdout(open(os.devnull, "w")):
muscle(fasta, out=out, super5=True)
# Expected result
ref_path = "tests/fixtures/muscle_super5_aa_test.afa"
self.assertTrue(
filecmp.cmp(out, ref_path, shallow=False),
"The reference and muscle super5 amino acid alignment are not the same.",
)
def tearDown(self):
super(TestMuscleAASuper, self).tearDown()
# Delete temporary result file
os.remove("tests/fixtures/tmp.afa")
class TestMusclePrints(unittest.TestCase):
def test_muscle_print_nt(self):
# File with sequences to align
fasta = "tests/fixtures/muscle_nt_print_test.fa"
# Capture muscle print output (for some reason, this only captures the last print output)
with mock.patch("builtins.print") as print_mock:
# Run muscle
muscle(fasta)
# print_mock.assert_called_with("\n")
# print_mock.assert_called_with("test1\n", "\x1b[38;5;15m\x1b[48;5;9mA\x1b[0;0m")
print_mock.assert_called_with(
"test2\n", "\x1b[38;5;15m\x1b[48;5;9mA\x1b[0;0m"
)
| 33.256944
| 97
| 0.634162
| 602
| 4,789
| 4.933555
| 0.177741
| 0.091919
| 0.07037
| 0.063973
| 0.831987
| 0.79697
| 0.755892
| 0.755892
| 0.755892
| 0.755892
| 0
| 0.01087
| 0.269994
| 4,789
| 143
| 98
| 33.48951
| 0.838673
| 0.201295
| 0
| 0.542169
| 0
| 0.012048
| 0.26048
| 0.166886
| 0
| 0
| 0
| 0
| 0.072289
| 1
| 0.13253
| false
| 0
| 0.072289
| 0
| 0.26506
| 0.048193
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
b86c75bd7baf069c9410eb4e2e4e200bc3630b89
| 143
|
py
|
Python
|
file_import_export/urls.py
|
sharif-42/News_Aggregation_System
|
8df4b562e57410bf059bb38367a14ac5ba12fb00
|
[
"MIT"
] | null | null | null |
file_import_export/urls.py
|
sharif-42/News_Aggregation_System
|
8df4b562e57410bf059bb38367a14ac5ba12fb00
|
[
"MIT"
] | 4
|
2021-03-19T02:55:45.000Z
|
2021-06-10T19:08:12.000Z
|
file_import_export/urls.py
|
sharif-42/News_Aggregation_System
|
8df4b562e57410bf059bb38367a14ac5ba12fb00
|
[
"MIT"
] | null | null | null |
from django.urls import path, include
from .views import import_export_data
urlpatterns = [
path('news-processor/', import_export_data)
]
| 20.428571
| 47
| 0.769231
| 19
| 143
| 5.578947
| 0.631579
| 0.226415
| 0.301887
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.13986
| 143
| 6
| 48
| 23.833333
| 0.861789
| 0
| 0
| 0
| 0
| 0
| 0.104895
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.6
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
b8a623d1edd1a87f5ab63636685bf870ba40ca4e
| 128
|
py
|
Python
|
transformers_interpret/explainers/__init__.py
|
MichalMalyska/transformers-interpret
|
878ec4b6928e2417a3ffe8499be52033938090f0
|
[
"Apache-2.0"
] | 1
|
2021-07-06T21:07:49.000Z
|
2021-07-06T21:07:49.000Z
|
transformers_interpret/explainers/__init__.py
|
MichalMalyska/transformers-interpret
|
878ec4b6928e2417a3ffe8499be52033938090f0
|
[
"Apache-2.0"
] | null | null | null |
transformers_interpret/explainers/__init__.py
|
MichalMalyska/transformers-interpret
|
878ec4b6928e2417a3ffe8499be52033938090f0
|
[
"Apache-2.0"
] | null | null | null |
from .question_answering import QuestionAnsweringExplainer
from .sequence_classification import SequenceClassificationExplainer
| 42.666667
| 68
| 0.921875
| 10
| 128
| 11.6
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0625
| 128
| 2
| 69
| 64
| 0.966667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
b229c562203fd99d0baecd8100ebda42038568d6
| 36
|
py
|
Python
|
src/case_rate/cli/__init__.py
|
richengguy/case-rate
|
4486343d091cbf3be1a850c0bef28c2c9da4c0a6
|
[
"BSD-3-Clause"
] | null | null | null |
src/case_rate/cli/__init__.py
|
richengguy/case-rate
|
4486343d091cbf3be1a850c0bef28c2c9da4c0a6
|
[
"BSD-3-Clause"
] | null | null | null |
src/case_rate/cli/__init__.py
|
richengguy/case-rate
|
4486343d091cbf3be1a850c0bef28c2c9da4c0a6
|
[
"BSD-3-Clause"
] | 1
|
2021-10-25T00:03:14.000Z
|
2021-10-25T00:03:14.000Z
|
from .cli import main # noqa: F401
| 18
| 35
| 0.694444
| 6
| 36
| 4.166667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107143
| 0.222222
| 36
| 1
| 36
| 36
| 0.785714
| 0.277778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
a28449f5194c6ada88d6d0133300d04ed9f67bfc
| 403
|
py
|
Python
|
tests/test_django_proj/app/views.py
|
HakurouKen/django-auto-route
|
1f98ba24cb04e271b2c475524eb797a1bc12ae56
|
[
"MIT"
] | null | null | null |
tests/test_django_proj/app/views.py
|
HakurouKen/django-auto-route
|
1f98ba24cb04e271b2c475524eb797a1bc12ae56
|
[
"MIT"
] | null | null | null |
tests/test_django_proj/app/views.py
|
HakurouKen/django-auto-route
|
1f98ba24cb04e271b2c475524eb797a1bc12ae56
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from autoroute import route
@route()
def auto_generated(request):
return HttpResponse("A default auto-generated route")
@route(name='with-name')
def with_name(request):
return HttpResponse("A route with name.")
@route(url='/custom/',name='custom-name')
def custom_route(request):
return HttpResponse("This is a custom route.")
| 25.1875
| 57
| 0.727047
| 55
| 403
| 5.272727
| 0.418182
| 0.134483
| 0.258621
| 0.17931
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002857
| 0.131514
| 403
| 15
| 58
| 26.866667
| 0.825714
| 0.052109
| 0
| 0
| 1
| 0
| 0.260526
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0
| 0.181818
| 0.272727
| 0.727273
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 6
|
a2a51b6d9c03750552a501e7c016162250ed91c3
| 12,259
|
py
|
Python
|
ecsclient/common/monitoring/dashboard.py
|
lipak2345/python-ecsclient
|
d3f61497348f7c89c760c036d010aa6ca1317c22
|
[
"Apache-2.0"
] | null | null | null |
ecsclient/common/monitoring/dashboard.py
|
lipak2345/python-ecsclient
|
d3f61497348f7c89c760c036d010aa6ca1317c22
|
[
"Apache-2.0"
] | null | null | null |
ecsclient/common/monitoring/dashboard.py
|
lipak2345/python-ecsclient
|
d3f61497348f7c89c760c036d010aa6ca1317c22
|
[
"Apache-2.0"
] | null | null | null |
# Standard lib imports
import logging
# Third party imports
# None
# Project level imports
# None
log = logging.getLogger(__name__)
class Dashboard(object):
def __init__(self, connection):
"""
Initialize a new instance
"""
self.conn = connection
def get_local_zone(self, *args, **kwargs):
"""
Gets the local VDC details
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category', 'cfTimeFrame', 'cfTarget']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting local VDC info")
return self.conn.get(url='dashboard/zones/localzone', params=param)
def get_local_zone_replication_groups(self, *args, **kwargs):
"""
Gets the local VDC replication groups details
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting vpools in local VDC")
return self.conn.get(url='dashboard/zones/localzone/replicationgroups', params=param)
def get_local_zone_rglinks_failed(self, *args, **kwargs):
"""
Gets the local VDC replication group failed links details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
{
u'_embedded': {
u'_instances': [
]
},
u'_links': {
u'self': {
u'href': u'/dashboard/zones/localzone/rglinksFailed'
}
},
u'title': u'rglinksFailedList'
}
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting failed links for vpools in local VDC")
return self.conn.get(url='dashboard/zones/localzone/rglinksFailed')
def get_local_zone_storage_pools(self, *args, **kwargs):
"""
Gets the local VDC storage pool details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category', 'cfTimeFrame', 'cfTarget']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting varrays in local VDC")
return self.conn.get(url='dashboard/zones/localzone/storagepools', params=param)
def get_local_zone_nodes(self, *args, **kwargs):
"""
Gets the local vdc node details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category', 'cfTimeFrame', 'cfTarget']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting nodes in local VDC")
return self.conn.get(url='dashboard/zones/localzone/nodes', params=param)
def get_storage_pool(self, storage_pool_id, *args, **kwargs):
"""
Gets the storage pool details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
:param storage_pool_id: Storage pool identifier
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category', 'cfTimeFrame', 'cfTarget']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting info for varray '{0}'".format(storage_pool_id))
return self.conn.get(
url='dashboard/storagepools/{0}'.format(storage_pool_id), params=param)
def get_node(self, node_id, *args, **kwargs):
"""
Gets the node instance details
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
:param node_id: Node identifier
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category', 'cfTimeFrame', 'cfTarget']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting info for node '{0}'".format(node_id))
return self.conn.get(
url='dashboard/nodes/{0}'.format(node_id))
def get_disk(self, disk_id, *args, **kwargs):
"""
Gets the disk instance details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
:param disk_id: Storage pool identifier
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting info for disk '{0}'".format(disk_id))
return self.conn.get(
url='dashboard/disks/{0}'.format(disk_id), params=param)
def get_process(self, process_id, *args, **kwargs):
"""
Gets the process instance details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
:param process_id: Identity of the process
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting info for PID '{0}'".format(process_id))
return self.conn.get(
url='dashboard/processes/{0}'.format(process_id), params=param)
def get_node_processes(self, node_id, *args, **kwargs):
"""
Gets the node instance process details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
:param node_id: Identity of the process
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting processes for node '{0}'".format(node_id))
return self.conn.get(
url='dashboard/nodes/{0}/processes'.format(node_id), params=param)
def get_node_disks(self, node_id, *args, **kwargs):
"""
Gets the node instance disk details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
:param node_id: Identity of the node
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting disks for node '{0}'".format(node_id))
return self.conn.get(
url='dashboard/nodes/{0}/disks'.format(node_id), params=param)
def get_storage_pool_nodes(self, storage_pool_id, *args, **kwargs):
"""
Gets the storage pool node details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
:param storage_pool_id: Identity of the storage pool
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category', 'cfTimeFrame', 'cfTarget']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting nodes for varray '{0}'".format(storage_pool_id))
return self.conn.get(
url='dashboard/storagepools/{0}/nodes'.format(storage_pool_id), params=param)
def get_local_zone_replication_group_bootstrap_links(self, *args, **kwargs):
"""
Gets the local VDC replication group bootstrap links details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
{
u'_embedded': {
u'_instances': [
]
},
u'_links': {
u'self': {
u'href': u'/dashboard/zones/localzone/rglinksBootstrap'
}
},
u'title': u'rglinksBootstrapList'
}
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting vpool bootstrap links in local VDC")
return self.conn.get(
url='dashboard/zones/localzone/rglinksBootstrap', params=param)
def get_replication_group(self, replication_group_id, *args, **kwargs):
"""
Gets the replication group instance details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
:param replication_group_id: Replication group identifier
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting info for vpool '{0}'".format(replication_group_id))
return self.conn.get(
url='dashboard/replicationgroups/{0}'.format(replication_group_id), params=param)
def get_replication_group_link(self, rglink_id, *args, **kwargs):
"""
Gets the replication group link instance details
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
:param rglink_id: Replication group link identifier
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting info for vpool link '{0}'".format(rglink_id))
return self.conn.get(url='dashboard/rglinks/{0}'.format(rglink_id), params=param)
def get_replication_group_links(self, replication_group_id, *args, **kwargs):
"""
Gets the replication group instance associated link details.
Required role(s):
SYSTEM_ADMIN
SYSTEM_MONITOR
Example JSON result from the API:
Too large to output here
:param replication_group_id: Replication group identifier
"""
keys = ['dataType', 'startTime', 'endTime', 'interval', 'category']
param = {}
for key in keys:
value = kwargs.get(key)
if value:
param[key] = value
log.info("Getting links for vpool '{0}'".format(replication_group_id))
return self.conn.get(
url='dashboard/replicationgroups/{0}/rglinks'.format(
replication_group_id),
params=param
)
| 26.883772
| 102
| 0.555347
| 1,347
| 12,259
| 4.946548
| 0.083148
| 0.048026
| 0.033618
| 0.040822
| 0.875431
| 0.866877
| 0.835059
| 0.775026
| 0.751763
| 0.721897
| 0
| 0.002463
| 0.337711
| 12,259
| 455
| 103
| 26.942857
| 0.818204
| 0.275308
| 0
| 0.654321
| 0
| 0
| 0.225764
| 0.058483
| 0
| 0
| 0
| 0
| 0
| 1
| 0.104938
| false
| 0
| 0.006173
| 0
| 0.216049
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a2c99c67067d0e9fd54ac9db1406ffcbab3fb8b7
| 38
|
py
|
Python
|
api/__init__.py
|
satyamroy001/Magnum
|
7311b861514e039be48d72cfb3bfb6145f06d3dd
|
[
"MIT"
] | 2
|
2021-01-31T04:33:25.000Z
|
2022-03-05T03:34:57.000Z
|
api/__init__.py
|
satyamroy001/Magnum
|
7311b861514e039be48d72cfb3bfb6145f06d3dd
|
[
"MIT"
] | null | null | null |
api/__init__.py
|
satyamroy001/Magnum
|
7311b861514e039be48d72cfb3bfb6145f06d3dd
|
[
"MIT"
] | null | null | null |
"""Exports GPT"""
from .gpt import *
| 9.5
| 18
| 0.605263
| 5
| 38
| 4.6
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.184211
| 38
| 3
| 19
| 12.666667
| 0.741935
| 0.289474
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
a2e5d16805050250e4444720f22b21983d1baac8
| 172,437
|
py
|
Python
|
RLBotPack/Kamael/beard_states.py
|
FootlessQuill54/RLBotPack
|
6960df7cd7d35e9af6d082c808b1bd3983f17823
|
[
"MIT"
] | null | null | null |
RLBotPack/Kamael/beard_states.py
|
FootlessQuill54/RLBotPack
|
6960df7cd7d35e9af6d082c808b1bd3983f17823
|
[
"MIT"
] | null | null | null |
RLBotPack/Kamael/beard_states.py
|
FootlessQuill54/RLBotPack
|
6960df7cd7d35e9af6d082c808b1bd3983f17823
|
[
"MIT"
] | null | null | null |
from beard_utilities import *
import math
from rlbot.agents.base_agent import BaseAgent, SimpleControllerState
from rlbot.utils.structures.game_data_struct import GameTickPacket
from rlbot.utils.game_state_util import (
GameState,
BallState,
CarState,
Physics,
Vector3,
Rotator,
)
import random
"""
Right corner loc: (-2048, -2560), yaw: 0.25 pi loc: (2048, 2560), yaw: -0.75 pi
Left corner loc: (2048, -2560), yaw: 0.75 pi loc: (-2048, 2560), yaw: -0.25 pi
Back right loc: (-256.0, -3840), yaw: 0.5 pi loc: (256.0, 3840), yaw: -0.5 pi
Back left loc: (256.0, -3840), yaw: 0.5 pi loc: (-256.0, 3840), yaw: -0.5 pi
Far back center loc: (0.0, -4608), yaw: 0.5 pi loc: (0.0, 4608), yaw: -0.5 pi
"""
def locked_in(agent, agentType):
if agentType == LeapOfFaith:
if agent.activeState.active != False:
return True
if agentType == Divine_Mandate:
if agent.activeState.active != False:
return True
if agentType == airLaunch:
if agent.activeState.active != False:
return True
if agentType == BlessingOfDexterity:
if agent.activeState.active != False:
return True
if agentType == Wings_Of_Justice:
if agent.activeState.active != False:
return True
if agentType == DivineGuidance:
if agent.activeState.active != False:
return True
if agentType == RighteousVolley:
if agent.activeState.active != False:
return True
if agentType == Special_Delivery:
if agent.activeState.active != False:
return True
return False
def getKickoffPosition(vec):
kickoff_locations = [[2048, 2560], [256, 3848], [0, 4608]]
# 0 == wide diagonal, 1 == short disgonal, 2 == middle
if abs(vec[0]) >= 350:
return 0
elif abs(vec[0]) > 5:
return 1
else:
return 2
class baseState:
def __init__(self, agent):
self.agent = agent
self.active = True
def __repr__(self):
return f"{type(self).__name__}"
class Player_reporter(baseState):
def update(self):
if len(self.agent.allies) > 0:
center = Vector([0, 5200 * -sign(self.agent.team), 200])
dummy = self.agent.allies[0]
shotAngle = math.degrees(angle2(dummy.location, center))
correctedAngle = correctAngle(shotAngle + 90 * -sign(self.agent.team))
# agent.log.append(
# f"natural angle: {shotAngle} || corrected angle: {correctedAngle}"
# )
print(distance2D(self.agent.allies[0].location, self.agent.ball.location))
else:
self.agent.log.append("waiting on player to join bot team")
return SimpleControllerState()
class State:
RESET = 0
WAIT = 1
INITIALIZE = 2
RUNNING = 3
class Kickoff_boosties(baseState):
def update(self):
return kickoff_boost_grabber(self.agent)
class airLaunch(baseState):
def __init__(self, agent):
baseState.__init__(self, agent)
self.initiated = agent.time
self.jumpTimer = agent.time
self.firstJump = False
self.secondJump = False
self.firstJumpHold = 0.5
self.secondJumpHold = 0.4
self.active = True
def update(self):
stateController = SimpleControllerState()
if not self.firstJump:
self.firstJump = True
stateController.jump = True
self.jumpTimer = self.agent.time
elif self.firstJump and not self.secondJump:
if self.agent.time - self.jumpTimer < self.firstJumpHold:
stateController.jump = True
elif (
self.agent.time - self.jumpTimer > self.firstJumpHold
and self.agent.time - self.jumpTimer < self.firstJumpHold + 0.05
):
stateController.boost = True
stateController.jump = False
else:
self.secondJump = True
stateController.boost = True
self.jumpTimer = self.agent.time
else:
if self.agent.time - self.jumpTimer < self.secondJumpHold:
stateController.jump = True
stateController.boost = True
else:
self.active = False
self.jump = False
self.agent.activeState = DivineGrace(self.agent)
if (
self.agent.time - self.jumpTimer > 0.15
and self.agent.time - self.jumpTimer < 0.35
):
stateController.pitch = 1
return stateController
class Aerial_Charge:
def __init__(self, agent, target: Vector):
self.target = target
self.agent = agent
self.active = True
self.anti_gravity_vec = Vector([0, 0, 1])
self.timer = 0
self.wallJump = self.agent.onWall
def update(self):
controls = SimpleControllerState()
controls.throttle = 0
self.timer += self.agent.deltaTime
# print(self.timer)
delta_a = calculate_delta_acceleration(
self.target - self.agent.me.location,
self.agent.me.velocity,
0.01,
self.agent.gravity,
)
if not self.agent.onSurface:
align_car_to(controls, self.agent.me.avelocity, delta_a, self.agent)
aim_target = (
(delta_a.normalize() + self.anti_gravity_vec).normalize().scale(2300)
)
if self.wallJump:
if self.timer <= 0.2:
controls.boost = (
self.agent._forward.dotProduct(delta_a.normalize()) > 0.6
and delta_a.magnitude() > 100
)
controls.jump = True
return controls
elif self.timer <= 0.2 + self.agent.fakeDeltaTime * 3:
controls.jump = False
controls.boost = (
self.agent._forward.dotProduct(delta_a.normalize()) > 0.6
and delta_a.magnitude() > 100
)
return controls
elif self.timer > 0.2 + self.agent.fakeDeltaTime * 3:
controls.steer, controls.roll, controls.yaw, controls.pitch = 0, 0, 0, 0
controls.jump = True
controls.boost = (
self.agent._forward.dotProduct(delta_a.normalize()) > 0.6
and delta_a.magnitude() > 100
)
if self.timer > 0.2 + self.agent.fakeDeltaTime * 6:
# print("Launch complete")
self.active = False
return controls
else:
controls.boost = (
self.agent._forward.dotProduct(delta_a.normalize()) > 0.6
and delta_a.magnitude() > 100
)
if self.timer < 0.2:
controls.jump = True
elif self.timer < 0.2 + self.agent.fakeDeltaTime * 3:
controls.jump = False
elif self.timer < 0.2 + self.agent.fakeDeltaTime * 5:
controls.steer, controls.roll, controls.yaw, controls.pitch = 0, 0, 0, 0
controls.jump = True
else:
controls.jump = True
self.active = False
return controls
print("error, launch condition out of range!")
self.active = False
return controls
class Wings_Of_Justice:
def __init__(self, agent, pred, target: Vector, time: float):
self.active = False
self.agent = agent
self.time = clamp(10, 0.0001, time)
self.airborne = False
self.launcher = None
self.pred = predictionStruct(
convertStructLocationToVector(pred), pred.game_seconds
)
self.target = target
self.drive_controls = SimpleControllerState()
self.launch_projection = None
self.started = self.agent.time
self.powershot = (
distance2D(target, Vector([0, 5200 * -sign(agent.team), 0])) > 2000
)
self.point_time = 1.5
def setup(self):
# print(f"in setup {self.agent.time}")
if self.agent.onSurface:
launching = False
dt = self.pred.time - self.agent.time
delta_a = calculate_delta_acceleration(
self.target - self.agent.me.location,
self.agent.jumpPhysics.velocity,
dt,
self.agent.gravity,
)
expedite = (
1058 * (self.agent.me.boostLevel - 10 / 33.333)
> delta_a.scale(dt).magnitude()
)
_direction = direction(self.agent.me.location, self.target)
destination = self.target + _direction.scale(150)
self.drive_controls = driveController(
self.agent,
destination,
self.pred.time,
expedite=expedite,
flippant=False,
maintainSpeed=False,
)
# zoneInfo= takeoff_goldielox_zone(self.agent,self.target)
if delta_a.magnitude() < 1050:
if (
abs(self.drive_controls.steer) <= 0.1
): # or self.agent.team == 1 and self.agent.currentSpd < 300: #self.agent.currentSpd < 300 or
if not self.agent.onWall:
projection = (
self.agent.me.location
+ self.agent.jumpPhysics.velocity.scale(1.5)
)
projected_delta_a = calculate_delta_acceleration(
self.target - projection,
self.agent.jumpPhysics.velocity,
dt,
self.agent.gravity,
)
launching = True
else:
launching = True
if not launching:
self.active = False
else:
if distance2D(self.target, self.agent.me.location) <= 5000:
if not self.agent.onWall:
self.launcher = self.agent.createJumpChain(
2, 400, jumpSim=None, set_state=False, aim=False
)
else:
# self.launcher = Aerial_Charge(self.agent, self.target)
self.launcher = Divine_Mandate(
self.agent, [SimpleControllerState(jump=True)], [0.10]
)
self.active = True
else:
self.active = False
else:
self.active = True
def update(self):
controls = SimpleControllerState()
controls.throttle = 0
dt = self.pred.time - self.agent.time
target = self.target
createBox(self.agent, self.pred.location)
delta_a = calculate_delta_acceleration(
target - self.agent.me.location,
self.agent.me.velocity,
dt,
self.agent.gravity,
)
if self.agent.time - self.started > 0.5:
if self.launch_projection != None:
self.agent.log.append(
f"Projected delta_a after launcher: {str(self.launch_projection)[:6]}, in reality: {str(delta_a.magnitude())[:6]}"
)
self.launch_projection = None
pred_valid = validateExistingPred(self.agent, self.pred)
if self.agent.onSurface and self.launcher == None:
self.setup()
if self.launcher == None:
return self.drive_controls
if self.launcher != None:
controls = self.launcher.update()
if not self.launcher.active:
self.launcher = None
return controls
boost_req = (
clamp(
self.agent.boost_duration_min,
1,
abs(
self.agent.boost_duration_min
- clamp(self.agent.boost_duration_min, 0, self.agent.boost_counter)
),
)
* self.agent.aerialAccelerationTick
)
# if dt <= self.point_time:
# boost_req= 8*self.agent.aerialAccelerationTick
aligned_threshold = 0.7
current_alignment = self.agent._forward.dotProduct(delta_a.normalize())
if dt > self.point_time or delta_a.magnitude() > boost_req:
align_car_to(controls, self.agent.me.avelocity, delta_a, self.agent)
aligned = current_alignment > aligned_threshold
controls.boost = aligned and delta_a.magnitude() > boost_req
if delta_a.magnitude() > 66 * self.agent.fakeDeltaTime and aligned:
controls.throttle = 1
if delta_a.magnitude() > 1058 and dt > 1 and not self.launcher:
self.active = False
self.agent.log.append(
f"required acceleration too high {delta_a.magnitude()}"
)
else:
if (
distance2D(
self.pred.location, Vector([0, 5200 * -sign(self.agent.team), 0])
)
> 2000
):
offset = Vector([0, 0, -25])
else:
offset = Vector([0, 0, 10])
target = self.pred.location + offset
if not pred_valid:
target = self.agent.ball.location + offset
(
controls.steer,
controls.yaw,
controls.pitch,
_roll,
_,
) = point_at_position(self.agent, target)
controls.roll = turnController(
self.agent.me.rotation[2], self.agent.me.rotational_velocity[0] / 4
)
if not pred_valid:
if self.launch_projection != None:
self.agent.log.append(
f"Projected delta_a after launcher: {str(self.launch_projection)[:6]}, in reality: {str(delta_a.magnitude())[:6]}"
)
self.launch_projection = None
if self.launcher == None:
self.active = False
if dt <= 0:
self.active = False
self.agent.log.append("Aerial timed out")
if self.agent.onSurface:
self.agent.log.append("canceling aerial since we're on surface")
self.active = False
if dt > self.point_time:
req_vel = self.agent.me.velocity + delta_a
if req_vel.magnitude() > 2300 and self.launcher:
self.active = False
return controls
class Celestial_Arrest(baseState):
def update(self):
return catch_ball(self.agent)
class Special_Delivery(baseState):
def __init__(self, agent):
super().__init__(agent)
# self.jump_action = Divine_Mandate(self.agent,[SimpleControllerState(jump=True,pitch=1),SimpleControllerState(pitch=1),SimpleControllerState(jump=True)],[self.agent.fakeDeltaTime*9,self.agent.fakeDeltaTime*6,self.agent.fakeDeltaTime*3])
self.jump_action = LeapOfFaith(agent, 2)
self.active = True
def update(self):
# print("special delivery in update")
if self.jump_action.active:
return self.jump_action.update()
controls = SimpleControllerState()
offset = Vector([0, 60 * sign(self.agent.team), 50])
(
controls.steer,
controls.yaw,
controls.pitch,
controls.roll,
error,
) = point_at_position(self.agent, self.agent.ball.location + offset)
controls.boost = error < 0.75
if (
self.agent.me.boostLevel <= 0
or self.agent.me.location[2] < 60
or findDistance(self.agent.me.location, self.agent.ball.location) > 400
or error > 5
or self.agent.onSurface
):
self.active = False
# print(f"point error is: {error}")
return controls
class LeapOfFaith(baseState):
def __init__(self, agent, targetCode, target=None):
self.agent = agent
self.active = True
self.targetCode = targetCode # 0 flip at ball , 1 flip forward, 2 double jump, 3 flip backwards, 4 flip left, 5 flip right, 6 flip at target ,7 left forward diagnal flip, 8 right forward diagnal flip , -1 hold single jump
self.flip_obj = FlipStatus(agent.time)
self.target = target
self.cancelTimerCap = 0.3
self.cancelStartTime = None
self.jumped = False
self.followThrough = 0
self.start_time = self.agent.time
self.last_controller = SimpleControllerState()
def update(self):
controller_state = SimpleControllerState()
jump = flipHandler(self.agent, self.flip_obj)
if jump:
if self.targetCode == 1:
controller_state.pitch = -1
controller_state.roll = 0
controller_state.throttle = 1
elif self.targetCode == 0:
# ball_local = toLocal(
# self.agent.ball.location, self.agent.me
# ).normalize()
ball_local = self.agent.ball.local_location
ball_angle = math.atan2(ball_local.data[1], ball_local.data[0])
controller_state.jump = True
yaw = math.sin(ball_angle)
pitch = -math.cos(ball_angle)
yp = Vector([abs(yaw), abs(pitch)])
yp = yp.normalize()
if yaw > 0:
yaw = yp[0]
else:
yaw = -yp[0]
if pitch > 0:
pitch = yp[1]
else:
pitch = -yp[1]
controller_state.yaw = yaw
controller_state.pitch = pitch
if pitch > 0:
controller_state.throttle = -1
else:
controller_state.throttle = 1
elif self.targetCode == 2:
controller_state.pitch = 0
controller_state.steer = 0
controller_state.yaw = 0
elif self.targetCode == 3:
controller_state.pitch = 1
controller_state.steer = 0
controller_state.throttle = -1
elif self.targetCode == -1:
controller_state.pitch = 0
controller_state.steer = 0
controller_state.throttle = 0
elif self.targetCode == 4:
controller_state.pitch = 0
controller_state.yaw = -1
controller_state.steer = -1
controller_state.throttle = 1
# print("in left side flip")
elif self.targetCode == 5:
controller_state.pitch = 0
controller_state.yaw = 1
controller_state.steer = 1
controller_state.throttle = 1
# print("in right side flip")
elif self.targetCode == 6:
target_local = toLocal(self.target, self.agent.me).normalize()
target_angle = math.atan2(target_local.data[1], target_local.data[0])
controller_state.jump = True
controller_state.yaw = math.sin(target_angle)
pitch = -math.cos(target_angle)
controller_state.pitch = pitch
if pitch > 0:
controller_state.throttle = -1
else:
controller_state.throttle = 1
elif self.targetCode == 7:
controller_state.pitch = -1
controller_state.yaw = -1
controller_state.steer = -1
controller_state.throttle = 1
elif self.targetCode == 8:
controller_state.pitch = -1
controller_state.yaw = 1
controller_state.steer = 1
controller_state.throttle = 1
elif self.targetCode == 9:
# diagnal flip cancel
controller_state.pitch = -0.2
controller_state.yaw = -0.8
# controller_state.steer = -1
controller_state.throttle = 1
elif self.targetCode == 10:
# diagnal flip cancel
controller_state.pitch = -0.2
controller_state.yaw = 0.8
# controller_state.steer = -1
controller_state.throttle = 1
controller_state.jump = jump
controller_state.boost = False
if self.targetCode == 7 or self.targetCode == 8:
controller_state.boost = True
if self.flip_obj.flipDone:
if self.targetCode != 9 or self.targetCode != 10:
controller_state = self.last_controller
if (
self.followThrough < 0.4
and self.targetCode != 2
and self.targetCode != -1
):
self.followThrough += self.agent.deltaTime
else:
self.active = False
else:
if not self.cancelStartTime:
self.cancelStartTime = self.agent.time
return controller_state
if self.targetCode == 9:
controller_state.pitch = 1
controller_state.roll = 1
controller_state.throttle = 1
else:
controller_state.pitch = 1
controller_state.roll = -1
controller_state.throttle = 1
if self.agent.time - self.cancelStartTime >= self.cancelTimerCap:
self.active = False
# if self.agent.forward:
# controller_state.throttle = 1
# else:
# controller_state.throttle = -1
if self.agent.onSurface:
if self.agent.time - self.start_time > 0.2:
self.active = False
self.last_controller = controller_state
return controller_state
class Divine_Mandate:
# class for performing consecutive inputs over set periods of time. Example: Flipping forward
def __init__(self, agent, controls_list: list, durations_list: list):
self.controls = controls_list
self.durations = durations_list
self.complete = False
self.index = 0
self.current_duration = 0
self.agent = agent
# there should be a duration in the durations for every controller given in the list. This inserts 0 for any lacking
if len(durations_list) < len(controls_list):
self.durations += [0 * len(controls_list) - len(durations_list)]
self.active = True
def create_custom_controls(self, actionCode):
# perform specialized actions if creating controlers at creation time wasn't feasible
controller_state = SimpleControllerState()
if actionCode == 0:
ball_local = localizeVector(
self.agent.ball.location + Vector([0, 0, 40]), self.agent.me
)
ball_angle = math.atan2(ball_local.data[1], ball_local.data[0])
controller_state.jump = True
# controller_state.yaw = math.sin(ball_angle)
# pitch = -math.cos(ball_angle)
yaw = math.sin(ball_angle)
pitch = -math.cos(ball_angle)
yp = Vector([abs(yaw), abs(pitch)])
yp = yp.normalize()
if yaw > 0:
yaw = yp[0]
else:
yaw = -yp[0]
if pitch > 0:
pitch = yp[1]
else:
pitch = -yp[1]
controller_state.pitch = pitch
controller_state.yaw = yaw
if pitch > 0:
controller_state.throttle = -1
else:
controller_state.throttle = 1
self.controls[self.index] = controller_state
if actionCode == 1:
(
controller_state.steer,
controller_state.yaw,
controller_state.pitch,
controller_state.roll,
_,
) = point_at_position(
self.agent, self.agent.ball.location + Vector([0, 0, 65])
)
controller_state.jump = False
controller_state.throttle = 1
# print(f"agent height is : {self.agent.me.location[2]}")
return controller_state
def update(
self,
): # call this once per frame with delta time to recieve updated controls
self.current_duration += self.agent.deltaTime
if self.current_duration > self.durations[self.index]:
self.index += 1
self.current_duration = self.current_duration - self.agent.deltaTime
# self.current_duration = 0
if self.index == len(self.controls):
self.active = False
return SimpleControllerState()
if type(self.controls[self.index]) == SimpleControllerState:
return self.controls[self.index]
else:
return self.create_custom_controls(self.controls[self.index])
class RighteousVolley(baseState):
def __init__(self, agent, delay, target):
baseState.__init__(self, agent)
self.smartAngle = False
self.target = target
height = target[2]
boomerDelay = 0.05
# if len(agent.allies) < 1:
# boomerDelay = 0
delay = clamp(1.25, 0.3, delay + boomerDelay)
if delay >= 0.3:
if height <= 200:
# print("tiny powershot")
self.jumpTimerMax = 0.1
self.angleTimer = clamp(0.15, 0.05, self.jumpTimerMax / 2)
else:
# print("normal powershot")
self.jumpTimerMax = delay - 0.2
self.angleTimer = clamp(0.15, 0.1, self.jumpTimerMax / 2)
self.delay = delay
if self.delay >= 0.5:
self.smartAngle = True
self.jumped = False
self.jumpTimer = 0
# print("setting action to powershot")
def update(self):
controller_state = SimpleControllerState()
controller_state.throttle = 0
controller_state.boost = False
ball_local = toLocal(self.agent.ball.location, self.agent.me).normalize()
# ball_local = toLocal(self.target, self.agent.me)
ball_angle = math.atan2(ball_local.data[1], ball_local.data[0])
angle_degrees = correctAngle(math.degrees(ball_angle))
if not self.jumped:
self.jumped = True
controller_state.jump = True
return controller_state
else:
self.jumpTimer += self.agent.deltaTime
if self.jumpTimer < self.angleTimer:
controller_state.pitch = 1
if self.jumpTimer < self.jumpTimerMax:
controller_state.jump = True
else:
controller_state.jump = False
if self.jumpTimer > self.jumpTimerMax:
if (
self.jumpTimer >= self.delay - 0.2
and self.jumpTimer < self.delay - 0.15
):
controller_state.jump = False
elif (
self.jumpTimer >= self.delay - 0.15
and self.jumpTimer < self.delay
):
controller_state.yaw = math.sin(ball_angle)
controller_state.pitch = -math.cos(ball_angle)
controller_state.jump = True
elif self.jumpTimer < self.delay + 0.1:
controller_state.jump = False
else:
self.active = False
controller_state.jump = False
return controller_state
class DivineRetribution:
def __init__(self, agent, targetCar):
self.agent = agent
self.targetCar = targetCar
self.active = True
def update(self,):
action = demoTarget(self.agent, self.targetCar)
return action
class DemolitionBot:
def __init__(self, agent):
self.agent = agent
self.active = True
def update(self):
target = self.agent.closestEnemyToBall
valid = False
if target.location[2] <= 90:
if (
target.location[1] > self.agent.ball.location[1]
and target.location[1] < self.agent.me.location[1]
) or (
target.location[1] < self.agent.ball.location[1]
and target.location[1] > self.agent.me.location[1]
):
valid = True
if valid:
return demoEnemyCar(self.agent, target)
else:
self.active = False
return ShellTime(self.agent)
class GroundShot(baseState):
def __init__(self, agent):
self.agent = agent
self.active = True
def update(self):
return lineupShot(self.agent, 3)
class GroundAssault(baseState):
def __init__(self, agent):
self.agent = agent
self.active = True
def update(self):
return lineupShot(self.agent, 1)
class DivineGuidance(baseState):
def __init__(self, agent, target):
self.controller = SimpleControllerState()
self.controller.jump = True
self.agent = agent
self.target = Vector([target[0], target[1], 30])
self.start_time = agent.time
self.active = True
def update(self):
temp_controller = SimpleControllerState(jump=True)
if self.agent.time - self.start_time < self.agent.fakeDeltaTime * 10:
temp_controller.jump = True
elif self.agent.time - self.start_time > 0.1:
temp_controller.jump = False
else:
temp_controller.jump = False
(
temp_controller.steer,
temp_controller.yaw,
temp_controller.pitch,
temp_controller.roll,
_,
) = point_at_position(self.agent, self.target.flatten())
if self.agent.time - self.start_time > 1.2:
self.active = False
if self.agent.onSurface:
if self.agent.time - self.start_time > 0.2:
self.active = False
return temp_controller
class HolyGrenade(baseState):
def __init__(self, agent):
self.agent = agent
self.active = True
def update(self):
return handleBounceShot(self.agent)
class HolyProtector(baseState):
def update(self):
return ShellTime(self.agent)
class AerialDefend(baseState):
pass
class TurnTowardsPosition(baseState):
def __init__(self, agent, target, targetCode): # 0 = ball.location
baseState.__init__(self, agent)
self.target = target
self.threshold = 1
self.targetCode = targetCode
def update(self):
if self.targetCode == 0:
self.target = self.agent.ball.location
localTarg = toLocal(self.target, self.agent.me)
localAngle = correctAngle(math.degrees(math.atan2(localTarg[1], localTarg[0])))
controls = SimpleControllerState()
if abs(localAngle) > self.threshold:
if self.agent.forward:
if localAngle > 0:
controls.steer = 1
else:
controls.steer = -1
controls.handbrake = True
if self.agent.currentSpd < 300:
controls.throttle = 0.5
else:
if localAngle > 0:
controls.steer = -0.5
else:
controls.steer = 1
controls.handbrake = True
if self.agent.currentSpd < 300:
controls.throttle = -0.5
else:
self.active = False
return controls
class Obstruct(baseState):
def update(self):
if not kickOffTest(self.agent):
return turtleTime(self.agent)
else:
self.active = False
self.agent.activeState = PreemptiveStrike(self.agent)
return self.agent.activeState.update()
"""
def getKickoffPosition(vec):
kickoff_locations = [[2048, 2560], [256, 3848], [0, 4608]]
for i in range(len(kickoff_locations)):
if kickoff_locations[i] == [abs(vec[0]),abs(vec[1])]:
return i
return -1
"""
class Kickoff(baseState):
def __init__(self, agent):
self.agent = agent
self.started = False
self.firstFlip = False
self.secondFlip = False
# if agent.team == 1:
# # self.finalFlipDistance = 500
# # else:
self.finalFlipDistance = 750
self.active = True
self.startTime = agent.time
self.flipState = None
def fakeKickOffChecker(self):
closestToBall, bDist = findEnemyClosestToLocation(
self.agent, self.agent.ball.location
)
myDist = findDistance(self.agent.me.location, self.agent.ball.location)
if bDist:
if bDist <= myDist * 0.75:
return True
else:
return False
return False
def retire(self):
self.active = False
self.agent.activeState = None
self.flipState = None
def update(self):
spd = self.agent.currentSpd
if self.flipState != None:
if self.flipState.active:
controller = self.flipState.update()
if self.agent.time - self.flipState.flip_obj.flipStartedTimer <= 0.15:
if spd < maxPossibleSpeed:
controller.boost = True
return controller
if self.secondFlip:
self.retire()
jumping = False
ballDistance = distance2D(self.agent.me.location, self.agent.ball.location)
if not self.started:
if not kickOffTest(self.agent):
self.started = True
self.startTime = self.agent.time
if self.started and self.agent.time - self.startTime > 2.5:
self.retire()
if not self.firstFlip:
if spd > 1100:
self.flipState = LeapOfFaith(
self.agent, 0, target=self.agent.ball.location
)
self.firstFlip = True
return self.flipState.update()
if ballDistance > self.finalFlipDistance:
destination = self.agent.ball.location
if not self.firstFlip:
if self.agent.me.location[0] > self.agent.ball.location[0]:
destination.data[0] -= 200
else:
destination.data[0] += 200
else:
if self.agent.me.location[0] > self.agent.ball.location[0]:
destination.data[0] -= 5
else:
destination.data[0] += 5
return greedyMover(self.agent, destination)
else:
# if self.agent.onSurface:
# if self.agent.team == 0:
self.flipState = LeapOfFaith(self.agent, 0)
self.secondFlip = True
return self.flipState.update()
# else:
# ball_local = self.agent.ball.local_location
# # 4 flip left, 5 flip right,
# if ball_local[0] > 10:
# self.flipState = LeapOfFaith(self.agent, 4)
# print("flipping left")
#
# elif ball_local[0] < -10:
# self.flipState = LeapOfFaith(self.agent, 5)
# print("flipping right")
# else:
# self.flipState = LeapOfFaith(self.agent, 0)
# print("flipping at ball")
#
# self.secondFlip = True
# return self.flipState.update()
# self.flipState = LeapOfFaith(self.agent, 0, self.agent.ball.location)
# self.secondFlip = True
# return self.flipState.update()
class Kickoff_Boosties(baseState):
def __init__(self, agent):
self.agent = agent
self.active = True
self.setup()
def setup(self):
closest_dist = math.inf
closest_loc = Vector([0, 0, 0])
for bb in self.agent.bigBoosts:
dist = distance2D(self.agent.me.location, bb.location)
if dist < closest_dist:
closest_dist = dist
closest_loc = bb.location
self.boost_target = closest_loc
def update(self):
if findDistance(self.agent.me.location, self.boost_target) < 100:
self.active = False
return driveController(
self.agent,
self.boost_target,
0.0001,
expedite=True,
flippant=True,
kickoff=True,
)
class HeavenlyReprieve(baseState):
def __init__(self, agent, boostloc):
self.agent = agent
self.boostLoc = boostloc
self.active = True
def update(self):
result = inCornerWithBoost(self.agent)
if result != False:
return refuel(self.agent, result[0])
else:
self.active = False
return ShellTime(self.agent)
class PreemptiveStrike(baseState):
def __init__(self, agent):
self.agent = agent
self.started = False
self.firstFlip = None
self.secondFlip = None
self.active = True
self.startTime = agent.time
self.kickoff_type = getKickoffPosition(agent.me.location)
# 0 == wide diagonal, 1 == short disgonal, 2 == middle
agent.stubbornessTimer = 5
self.onRight = True
self.short_offset = 75
self.setup()
self.enemyGoal = Vector([0, 5200 * -sign(self.agent.team), 0])
self.phase = 1
# if agent.team == 0:
# self.KO_option = PreemptiveStrike_botpack(agent)
# else:
self.KO_option = None
self.maintaining_speed = False
self.first_recovery = None
def create_speed_flip_cancel(self, left=False):
controls = []
timers = []
# first_controller = SimpleControllerState()
# if left:
# first_controller.steer = 1
# else:
# first_controller.steer = -1
#
# first_controller.handbrake = True
# first_controller.throttle = 1
# first_controller.boost = True
# first_controller.jump = False
# controls.append(first_controller)
# timers.append(self.agent.fakeDeltaTime * 1)
second_controller = SimpleControllerState()
# if left:
# second_controller.steer = 1
# else:
# second_controller.steer = -1
if not left:
second_controller.steer = 1
else:
second_controller.steer = -1
second_controller.throttle = 1
second_controller.boost = True
second_controller.jump = True
second_controller.pitch = 1
second_controller.handbrake = True
controls.append(second_controller)
timers.append(0.10)
third_controller = SimpleControllerState()
third_controller.jump = False
third_controller.boost = True
third_controller.throttle = 1
third_controller.pitch = 1
controls.append(third_controller)
timers.append(self.agent.fakeDeltaTime * 2)
fourth_controller = SimpleControllerState()
# yaw = 1
# if left:
# yaw = -1
yaw = -1
if left:
yaw = 1
fourth_controller.yaw = yaw
# fourth_controller.roll = yaw
fourth_controller.pitch = -1
fourth_controller.jump = True
fourth_controller.boost = True
fourth_controller.throttle = 1
controls.append(fourth_controller)
timers.append(0.05)
fifth_controller = SimpleControllerState()
fifth_controller.yaw = -yaw
# fifth_controller.roll = -yaw
fifth_controller.pitch = 1
fifth_controller.throttle = 1
fifth_controller.boost = True
fifth_controller.handbrake = False
fifth_controller.jump = True
controls.append(fifth_controller)
timers.append(0.75)
action = Divine_Mandate(self.agent, controls, timers)
# print(type(action))
return action
def create_diagonal_speed_flip(self, left=False):
controls = []
timers = []
# jump start
first_controller = SimpleControllerState()
if self.kickoff_type == 0:
if self.onRight:
first_controller.yaw = -1
else:
first_controller.yaw = 1
first_controller.jump = True
first_controller.boost = True
first_controller.throttle = 1
first_controller.pitch = -1
first_controller.jump = True
controls.append(first_controller)
timers.append(0.1)
# jump delay
second_controller = SimpleControllerState()
second_controller.jump = False
second_controller.boost = True
second_controller.throttle = 1
if left:
yaw = -0.75
else:
yaw = 0.75
pitch = -0.25
second_controller.yaw = yaw
second_controller.pitch = pitch
second_controller.jump = False
controls.append(second_controller)
timers.append(self.agent.fakeDeltaTime * 4)
# jump flip
third_controller = SimpleControllerState()
third_controller.jump = True
third_controller.boost = True
third_controller.throttle = 1
if left:
yaw = -0.75
else:
yaw = 0.75
pitch = -0.25
third_controller.yaw = yaw
third_controller.pitch = pitch
controls.append(third_controller)
timers.append(0.5)
action = Divine_Mandate(self.agent, controls, timers)
# print(type(action))
return action
def setup(self):
# setup randomness like offsets to either side of the ball. Make sure it's slightly offset from middle so we can flip center
# setup flips
ball_local = (
self.agent.ball.local_location
) # localizeVector(Vector([0, 0, 0]), self.agent.me)
if self.kickoff_type == 0:
if ball_local[1] > 0:
# self.firstFlip = self.create_diagonal_speed_flip(left=True)
# self.firstFlip = LeapOfFaith(self.agent,9)
self.firstFlip = self.create_speed_flip_cancel(left=False)
self.onRight = False
# print("flipping left")
else:
# self.firstFlip = self.create_diagonal_speed_flip(left=False)
# self.firstFlip = LeapOfFaith(self.agent, 10)
self.firstFlip = self.create_speed_flip_cancel(left=True)
self.onRight = True
# print("flipping right")
elif self.kickoff_type == 1:
if ball_local[1] < 0:
self.firstFlip = self.create_diagonal_speed_flip(left=False)
self.onRight = True
self.short_offset = -50 * sign(self.agent.team)
else:
self.firstFlip = self.create_diagonal_speed_flip(left=True)
self.onRight = False
self.short_offset = 50 * sign(self.agent.team)
# print(f"on left and short offset == {self.short_offset}")
else:
# middle kickoff defaulting to right
self.firstFlip = self.create_diagonal_speed_flip(left=True)
# self.onRight shouldn't matter
def wide_handler(self):
# stage 1 - drive to boost pad
if self.phase == 1:
if distance2D(self.agent.me.location, self.agent.ball.location) > 3150:
# return driveController(self.agent, self.enemyGoal+Vector([0,4000*sign(self.agent.team),0]),
return driveController(
self.agent,
self.agent.ball.location
+ Vector([0, sign(self.agent.team) * -100, 0]),
0,
expedite=True,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 3
# stage 3 - first flip
if self.phase == 3:
# if self.firstFlip == None:
# self.firstFlip = self.create_speed_flip_cancel(left=not self.onRight)
if self.firstFlip.active:
# print(f"first flip active: {str(self.firstFlip)} {self.agent.time} {self.firstFlip.targetCode}")
return self.firstFlip.update()
if not self.agent.onSurface:
_controller = SimpleControllerState()
(
_controller.steer,
_controller.yaw,
_controller.pitch,
_controller.roll,
_err,
) = point_at_position(self.agent, self.agent.me.location+ self.agent.me.velocity.normalize().flatten().scale(1000))
_controller.boost = True
_controller.handbrake = True
return _controller
else:
self.phase = 4
# print(f"switched to stage 4! {self.agent.time}")
# stage 4 - aim towards just offcenter of ball
if self.phase == 4:
if distance2D(self.agent.me.location, self.agent.ball.location) > 450:
if self.agent.me.location[0] > self.agent.ball.location[0]:
dummy_location = self.agent.ball.location + Vector(
[25, 120 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal,self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(distance2D(self.agent.me.location,dummy_location)*.5)
else:
dummy_location = self.agent.ball.location + Vector(
[-25, 120 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal, self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(
# distance2D(self.agent.me.location, dummy_location) * .5)
return driveController(
self.agent,
drive_target,
0,
expedite=not self.agent.superSonic,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 5
# print(f"switched to stage 5! {self.agent.time}")
# stage 5 - flip through center and end kickoff
# 4 flip left, 5 flip right
if self.phase == 5:
if self.secondFlip == None:
if (
self.agent.team == 0
and self.agent.me.location[0] < self.agent.ball.location[0]
or self.agent.team == 1
and self.agent.me.location[0] > self.agent.ball.location[0]
):
_code = 5
else:
_code = 4
# _code = 4
# else:
# _code = 5
self.secondFlip = LeapOfFaith(self.agent, _code, target=None)
controls = self.secondFlip.update()
if not self.secondFlip.active:
self.retire()
return controls
def short_handler(self):
# stage 1 - drive to boost pad
if self.phase == 1:
drive_target = Vector(
[self.short_offset, sign(self.agent.team) * 2825.0, 0]
)
if distance2D(self.agent.me.location, drive_target) > 575:
return driveController(
self.agent,
drive_target,
0,
expedite=True,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 3
# stage 2 - angle towards outside of ball
if self.phase == 2:
controls = SimpleControllerState()
if not self.agent.onSurface:
(
controls.steer,
controls.yaw,
controls.pitch,
controls.roll,
alignment_error,
) = point_at_position(self.agent, self.agent.me.location+ self.agent.me.velocity.normalize().flatten().scale(1000))
return controls
else:
self.phase = 3
# stage 3 - first flip
if self.phase == 3:
if self.firstFlip.active:
return self.firstFlip.update()
if not self.agent.onSurface:
_controller = SimpleControllerState()
(
_controller.steer,
_controller.yaw,
_controller.pitch,
_controller.roll,
_err,
) = point_at_position(self.agent,
self.agent.me.location + self.agent.me.velocity.normalize().flatten().scale(
1000))
_controller.boost = True
_controller.handbrake = True
return _controller
else:
self.phase = 4
# stage 4 - aim towards just offcenter of ball
if self.phase == 4:
if (
distance2D(self.agent.me.location, self.agent.ball.location) > 500
or not self.agent.onSurface
):
if self.agent.me.location[0] > self.agent.ball.location[0]:
dummy_location = self.agent.ball.location + Vector(
[65, 75 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal, self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(
# distance2D(self.agent.me.location, dummy_location) * .5)
else:
dummy_location = self.agent.ball.location + Vector(
[-65, 75 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal, self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(
# distance2D(self.agent.me.location, dummy_location) * .5)
return driveController(
self.agent,
drive_target,
0,
expedite=not self.agent.superSonic,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 5
# stage 5 - flip through center and end kickoff
# 4 flip left, 5 flip right
if self.phase == 5:
if self.secondFlip == None:
if (
self.agent.team == 0
and self.agent.me.location[0] < self.agent.ball.location[0]
or self.agent.team == 1
and self.agent.me.location[0] > self.agent.ball.location[0]
):
_code = 4
else:
_code = 5
#_code = 0
self.secondFlip = LeapOfFaith(self.agent, _code, target=None)
controls = self.secondFlip.update()
if not self.secondFlip.active:
self.retire()
return controls
def middle_handler(self):
# stage 1 - drive to boost pad
if self.phase == 1:
drive_target = Vector([0, sign(self.agent.team) * 4000, 0])
if distance2D(self.agent.me.location, drive_target) > 75:
return driveController(
self.agent,
drive_target,
0,
expedite=True,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 2
# stage 2 - angle towards outside of ball
if self.phase == 2:
drive_target = Vector([4500 * sign(self.agent.team), 0, 0])
if distance2D(self.agent.me.location, self.agent.ball.location) > 3850:#3875:
return driveController(
self.agent,
drive_target,
0,
expedite=True,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 3
# stage 3 - first flip
if self.phase == 3:
if self.firstFlip.active:
return self.firstFlip.update()
else:
if self.agent.onSurface:
self.phase = 4
else:
controls = SimpleControllerState()
(
controls.steer,
controls.yaw,
controls.pitch,
controls.roll,
alignment_error,
) = point_at_position(self.agent, self.agent.me.location+ self.agent.me.velocity.normalize().flatten().scale(1000))
return controls
# stage 4 - aim towards just offcenter of ball
if self.phase == 4:
if (
distance2D(self.agent.me.location, self.agent.ball.location) > 500
or not self.agent.onSurface
):
if self.agent.me.location[0] > self.agent.ball.location[0]:
dummy_location = self.agent.ball.location + Vector(
[55, 75 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal, self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(
# distance2D(self.agent.me.location, dummy_location) * .5)
else:
dummy_location = self.agent.ball.location + Vector(
[-55, 75 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal, self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(
# distance2D(self.agent.me.location, dummy_location) * .5)
return driveController(
self.agent,
drive_target,
0,
expedite=not self.agent.superSonic,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 5
# stage 5 - flip through center and end kickoff
# 4 flip left, 5 flip right
if self.phase == 5:
if self.secondFlip == None:
if (
self.agent.team == 0
and self.agent.me.location[0] < self.agent.ball.location[0]
or self.agent.team == 1
and self.agent.me.location[0] > self.agent.ball.location[0]
):
_code = 4
else:
_code = 5
#_code = 0
self.secondFlip = LeapOfFaith(self.agent, _code, target=None)
controls = self.secondFlip.update()
if not self.secondFlip.active:
self.retire()
return controls
def retire(self):
if self.phase != 5 or self.secondFlip == None or not self.secondFlip.active:
self.active = False
#self.agent.activeState = None
# print(f"retiring on stage {self.phase} {self.agent.time}")
def update(self):
if not self.agent.gameInfo.is_round_active:
self.setup()
if not self.agent.gameInfo.is_kickoff_pause:
# print(f"retiring due to kickoff pause")
self.retire()
if self.KO_option != None:
if not self.KO_option.active:
self.retire()
return self.KO_option.update()
# 0 == wide diagonal, 1 == short disgonal, 2 == middle
if self.kickoff_type == 0:
return self.wide_handler()
elif self.kickoff_type == 1:
return self.short_handler()
else:
return self.middle_handler()
class PreemptiveStrike_BAK(baseState): # real kickoff
def __init__(self, agent):
self.agent = agent
self.started = False
self.firstFlip = None
self.secondFlip = None
self.active = True
self.startTime = agent.time
self.kickoff_type = getKickoffPosition(agent.me.location)
agent.stubbornessTimer = 5
self.onRight = True
self.short_offset = 75
self.setup()
self.enemyGoal = Vector([0, 5200 * -sign(self.agent.team), 0])
self.phase = 1
self.KO_option = None
self.maintaining_speed = False
self.first_recovery = None
self.queued_retire = False
def create_speed_flip_cancel(self, left=False):
controls = []
timers = []
second_controller = SimpleControllerState()
if not left:
second_controller.steer = 1
else:
second_controller.steer = -1
second_controller.throttle = 1
second_controller.boost = True
second_controller.jump = True
second_controller.pitch = 1
second_controller.handbrake = True
controls.append(second_controller)
timers.append(0.10)
third_controller = SimpleControllerState()
third_controller.jump = False
third_controller.boost = True
third_controller.throttle = 1
third_controller.pitch = 1
controls.append(third_controller)
timers.append(self.agent.fakeDeltaTime * 2)
fourth_controller = SimpleControllerState()
yaw = -1
if left:
yaw = 1
fourth_controller.yaw = yaw
# fourth_controller.roll = yaw
fourth_controller.pitch = -1
fourth_controller.jump = True
fourth_controller.boost = True
fourth_controller.throttle = 1
controls.append(fourth_controller)
timers.append(0.05)
fifth_controller = SimpleControllerState()
fifth_controller.yaw = -yaw
# fifth_controller.roll = -yaw
fifth_controller.pitch = 1
fifth_controller.throttle = 1
fifth_controller.boost = True
fifth_controller.handbrake = False
fifth_controller.jump = True
controls.append(fifth_controller)
timers.append(0.75)
action = Divine_Mandate(self.agent, controls, timers)
# print(type(action))
return action
def create_diagonal_speed_flip(self, left=False):
controls = []
timers = []
# jump start
first_controller = SimpleControllerState()
if self.kickoff_type == 0:
if self.onRight:
first_controller.yaw = -1
else:
first_controller.yaw = 1
first_controller.jump = True
first_controller.boost = True
first_controller.throttle = 1
first_controller.pitch = -1
first_controller.jump = True
controls.append(first_controller)
timers.append(0.1)
# jump delay
second_controller = SimpleControllerState()
second_controller.jump = False
second_controller.boost = True
second_controller.throttle = 1
if left:
yaw = -0.75
else:
yaw = 0.75
pitch = -0.25
second_controller.yaw = yaw
second_controller.pitch = pitch
second_controller.jump = False
controls.append(second_controller)
timers.append(self.agent.fakeDeltaTime * 4)
# jump flip
third_controller = SimpleControllerState()
third_controller.jump = True
third_controller.boost = True
third_controller.throttle = 1
if left:
yaw = -0.75
else:
yaw = 0.75
pitch = -0.25
third_controller.yaw = yaw
third_controller.pitch = pitch
controls.append(third_controller)
timers.append(0.5)
action = Divine_Mandate(self.agent, controls, timers)
# print(type(action))
return action
def setup(self):
# setup randomness like offsets to either side of the ball. Make sure it's slightly offset from middle so we can flip center
# setup flips
ball_local = (
self.agent.ball.local_location
) # localizeVector(Vector([0, 0, 0]), self.agent.me)
if self.kickoff_type == 0:
if ball_local[1] > 0:
# self.firstFlip = self.create_diagonal_speed_flip(left=True)
# self.firstFlip = LeapOfFaith(self.agent,9)
self.firstFlip = self.create_speed_flip_cancel(left=False)
self.onRight = False
# print("flipping left")
else:
# self.firstFlip = self.create_diagonal_speed_flip(left=False)
# self.firstFlip = LeapOfFaith(self.agent, 10)
self.firstFlip = self.create_speed_flip_cancel(left=True)
self.onRight = True
# print("flipping right")
elif self.kickoff_type == 1:
if ball_local[1] < 0:
self.firstFlip = self.create_diagonal_speed_flip(left=False)
self.onRight = True
self.short_offset = -50 * sign(self.agent.team)
else:
self.firstFlip = self.create_diagonal_speed_flip(left=True)
self.onRight = False
self.short_offset = 50 * sign(self.agent.team)
# print(f"on left and short offset == {self.short_offset}")
else:
# middle kickoff defaulting to right
self.firstFlip = self.create_diagonal_speed_flip(left=True)
# self.onRight shouldn't matter
def wide_handler(self):
# stage 1 - drive to boost pad
if self.phase == 1:
if distance2D(self.agent.me.location, self.agent.ball.location) > 3150:
if self.agent.me.location[1] < 0:
y_off = -40
else:
y_off = 40
return driveController(
self.agent,
self.agent.ball.location + Vector([0, y_off, 0]),
0,
expedite=True,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 3
# stage 3 - first flip
if self.phase == 3:
if self.firstFlip.active:
return self.firstFlip.update()
# controls = self.firstFlip.update()
# if self.agent.currentSpd > 2210:
# controls.boost = False
# return controls
if not self.agent.onSurface:
_controller = SimpleControllerState()
(
_controller.steer,
_controller.yaw,
_controller.pitch,
_controller.roll,
_err,
) = point_at_position(
self.agent,
self.agent.me.location
+ self.agent.me.velocity.normalize().flatten().scale(1000),
)
_controller.boost = True
_controller.handbrake = True
return _controller
else:
self.phase = 4
# print(f"switched to stage 4! {self.agent.time}")
# stage 4 - aim towards just offcenter of ball
if self.phase == 4:
if distance2D(self.agent.me.location, self.agent.ball.location) > 550:
if self.agent.me.location[0] > self.agent.ball.location[0]:
dummy_location = self.agent.ball.location + Vector(
[35, 120 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal,self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(distance2D(self.agent.me.location,dummy_location)*.5)
else:
dummy_location = self.agent.ball.location + Vector(
[-35, 120 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal, self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(
# distance2D(self.agent.me.location, dummy_location) * .5)
return driveController(
self.agent,
drive_target,
0,
expedite=not self.agent.superSonic,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 5
# print(f"switched to stage 5! {self.agent.time}")
# stage 5 - flip through center and end kickoff
# 4 flip left, 5 flip right
if self.phase == 5:
# if distance2D(self.agent.closestEnemyToBall.location,self.agent.ball.location) < 600:
if self.secondFlip == None:
if (
self.agent.team == 0
and self.agent.me.location[0] < self.agent.ball.location[0]
or self.agent.team == 1
and self.agent.me.location[0] > self.agent.ball.location[0]
):
_code = 5
else:
_code = 4
# _code = 4
# else:
# _code = 5
self.secondFlip = LeapOfFaith(self.agent, _code, target=None)
controls = self.secondFlip.update()
if not self.secondFlip.active:
self.retire()
return controls
def short_handler(self):
# stage 1 - drive to boost pad
if self.phase == 1:
drive_target = Vector(
[self.short_offset, sign(self.agent.team) * 2850.0, 0]
)
if distance2D(self.agent.me.location, drive_target) > 575:
return driveController(
self.agent,
drive_target,
0,
expedite=True,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 3
# stage 2 - angle towards outside of ball
if self.phase == 2:
controls = SimpleControllerState()
if not self.agent.onSurface:
(
controls.steer,
controls.yaw,
controls.pitch,
controls.roll,
alignment_error,
) = point_at_position(
self.agent,
self.agent.me.location
+ self.agent.me.velocity.normalize().flatten().scale(1000),
)
return controls
else:
self.phase = 3
# stage 3 - first flip
if self.phase == 3:
if self.firstFlip.active:
controls = self.firstFlip.update()
if self.agent.currentSpd > 2210:
controls.boost = False
return controls
# return self.firstFlip.update()
if not self.agent.onSurface:
_controller = SimpleControllerState()
(
_controller.steer,
_controller.yaw,
_controller.pitch,
_controller.roll,
_err,
) = point_at_position(
self.agent,
self.agent.me.location
+ self.agent.me.velocity.normalize().flatten().scale(1000),
)
_controller.boost = True
_controller.handbrake = True
return _controller
else:
self.phase = 4
# stage 4 - aim towards just offcenter of ball
if self.phase == 4:
if (
distance2D(self.agent.me.location, self.agent.ball.location) > 550
or not self.agent.onSurface
):
if self.agent.me.location[0] > self.agent.ball.location[0]:
dummy_location = self.agent.ball.location + Vector(
[60, 120 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal, self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(
# distance2D(self.agent.me.location, dummy_location) * .5)
else:
dummy_location = self.agent.ball.location + Vector(
[-60, 120 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal, self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(
# distance2D(self.agent.me.location, dummy_location) * .5)
return driveController(
self.agent,
drive_target,
0,
expedite=not self.agent.superSonic,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 5
# stage 5 - flip through center and end kickoff
# 4 flip left, 5 flip right
if self.phase == 5:
if self.secondFlip == None:
if (
self.agent.team == 0
and self.agent.me.location[0] < self.agent.ball.location[0]
or self.agent.team == 1
and self.agent.me.location[0] > self.agent.ball.location[0]
):
_code = 4
else:
_code = 5
# _code = 0
self.secondFlip = LeapOfFaith(self.agent, _code, target=None)
controls = self.secondFlip.update()
if not self.secondFlip.active:
self.retire()
return controls
def middle_handler(self):
# stage 1 - drive to boost pad
if self.phase == 1:
drive_target = Vector([0, sign(self.agent.team) * 4000, 0])
if distance2D(self.agent.me.location, drive_target) > 75:
return driveController(
self.agent,
drive_target,
0,
expedite=True,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 2
# stage 2 - angle towards outside of ball
if self.phase == 2:
drive_target = Vector([4500 * sign(self.agent.team), 0, 0])
if (
distance2D(self.agent.me.location, self.agent.ball.location) > 3850
): # 3875:
return driveController(
self.agent,
drive_target,
0,
expedite=True,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 3
# stage 3 - first flip
if self.phase == 3:
if self.firstFlip.active:
controls = self.firstFlip.update()
if self.agent.currentSpd > 2210:
controls.boost = False
return controls
# return self.firstFlip.update()
else:
if self.agent.onSurface:
self.phase = 4
else:
controls = SimpleControllerState()
(
controls.steer,
controls.yaw,
controls.pitch,
controls.roll,
alignment_error,
) = point_at_position(
self.agent,
self.agent.me.location
+ self.agent.me.velocity.normalize().flatten().scale(1000),
)
return controls
# stage 4 - aim towards just offcenter of ball
if self.phase == 4:
if (
distance2D(self.agent.me.location, self.agent.ball.location) > 550
or not self.agent.onSurface
):
if self.agent.me.location[0] > self.agent.ball.location[0]:
dummy_location = self.agent.ball.location + Vector(
[45, 120 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal, self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(
# distance2D(self.agent.me.location, dummy_location) * .5)
else:
dummy_location = self.agent.ball.location + Vector(
[-45, 120 * sign(self.agent.team), 0]
)
# _direction = direction(self.enemyGoal, self.agent.ball.location)
drive_target = dummy_location # + _direction.scale(
# distance2D(self.agent.me.location, dummy_location) * .5)
return driveController(
self.agent,
drive_target,
0,
expedite=not self.agent.superSonic,
flippant=False,
maintainSpeed=self.maintaining_speed,
kickoff=True,
)
else:
self.phase = 5
# stage 5 - flip through center and end kickoff
# 4 flip left, 5 flip right
if self.phase == 5:
if self.secondFlip == None:
if (
self.agent.team == 0
and self.agent.me.location[0] < self.agent.ball.location[0]
or self.agent.team == 1
and self.agent.me.location[0] > self.agent.ball.location[0]
):
_code = 4
else:
_code = 5
# _code = 0
self.secondFlip = LeapOfFaith(self.agent, _code, target=None)
controls = self.secondFlip.update()
if not self.secondFlip.active:
self.retire()
return controls
def retire(self):
if (
not self.secondFlip
or not self.secondFlip.active
or self.agent.time - self.startTime > 3
):
self.active = False
else:
self.queued_retire = True
def update(self):
if not self.agent.gameInfo.is_round_active:
self.setup()
if not self.agent.gameInfo.is_kickoff_pause or self.agent.ball.location.flatten() != Vector(
[0, 0, 0]
):
# print(f"retiring due to kickoff pause")
self.retire()
if self.queued_retire:
self.retire()
if self.KO_option != None:
if not self.KO_option.active:
self.retire()
return self.KO_option.update()
# 0 == wide diagonal, 1 == short disgonal, 2 == middle
if self.kickoff_type == 0:
return self.wide_handler()
elif self.kickoff_type == 1:
return self.short_handler()
else:
return self.middle_handler()
class DivineGrace(baseState):
def __init__(self, agent):
self.agent = agent
self.active = True
# self.run_simulation()
# print(f"default elevation is: {self.agent.defaultElevation}")
self.x_limit = 4096 - self.agent.defaultElevation
self.y_limit = 5120 - self.agent.defaultElevation
self.ground_limit = self.agent.defaultElevation
self.ceiling_limit = 2044 - self.agent.defaultElevation
self.ideal_orientation = Vector([0, 0, 0])
self.tick_length = 5
self.squash_index = 0
self.update_count = 0
self.collision_timer = 0
self.collision_location = Vector([0, 0, 0])
self.aim_direction = None
self.recovery_limit = 1.5
def get_roll_value(self):
if self.roll_type == 1:
return turnController(
-self.agent.me.rotation[2], self.agent.me.rotational_velocity[0] / 4
) # will make bot roll top up
elif self.roll_type == 2:
return turnController(
self.agent.me.rotation[2], self.agent.me.rotational_velocity[0] / 4
) # will make bot roll top down
elif self.roll_type == 3:
return turnController(
-(3.1415 / 2) - self.agent.me.rotation[2],
self.agent.me.rotational_velocity[0] / 4,
) # will make bot roll top left
elif self.roll_type == 4:
return turnController(
3.1415 / 2 - self.agent.me.rotation[2],
self.agent.me.rotational_velocity[0] / 4,
) # will make bot roll top right
def get_controls(self):
controller_state = SimpleControllerState()
aim_vector = self.collision_location - self.agent.me.location
if self.collision_timer <= self.recovery_limit:
aim_vector.data[self.squash_index] = 0
if (
self.aim_direction != None
and self.collision_timer > self.recovery_limit
and self.agent.me.location[2] > 100
):
aim_vector = (
self.aim_direction
) # (self.aim_direction + aim_vector.normalize()).normalize()
aim_vector = aim_vector.normalize()
align_car_to(controller_state, self.agent.me.avelocity, aim_vector, self.agent)
# print(self.collision_timer)
if self.collision_timer > self.recovery_limit:
if self.agent._forward.dotProduct(aim_vector) > 0.7:
if abs(self.agent.me.velocity[2]) < 1500 or self.agent.boostMonster:
if self.agent.me.boostLevel > 20:
controller_state.boost = True
else:
controller_state.roll = self.get_roll_value()
if self.agent.time - self.agent.flipTimer < 0.5:
controller_state.roll = 0
controller_state.pitch = 0
controller_state.yaw = 0
controller_state.throttle = 1
return controller_state
def run_simulation(self):
self.update_count = 5
simulated_location = self.agent.me.location.scale(1)
simulated_velocity = self.agent.me.velocity.scale(1)
simulated_time = 0
self.aim_direction = None
while (
simulated_time < 10
): # 0 gravity could lead to infinite loop! may want to add hard limiters
simulated_velocity = simulated_velocity + Vector(
[0, 0, self.agent.gravity]
).scale((self.agent.fakeDeltaTime) * self.tick_length)
if simulated_velocity.magnitude() > 2300:
simulated_velocity = simulated_velocity.normalize().scale(2300)
simulated_location = simulated_location + simulated_velocity.scale(
(self.agent.fakeDeltaTime) * self.tick_length
)
simulated_time += self.agent.fakeDeltaTime * self.tick_length
if simulated_location[2] >= self.ceiling_limit:
self.roll_type = 2
self.squash_index = 2
# print(f"ceiling recovery {self.agent.time}")
self.aim_direction = Vector([0, 0, 1])
break
if simulated_location[2] <= self.ground_limit:
self.roll_type = 1
self.squash_index = 2
# print(f"ground recovery {self.agent.time}")
break
if simulated_location[0] <= -self.x_limit:
# on blue's right wall
# print(f"side wall recovery {self.agent.time}")
self.squash_index = 0
if simulated_velocity[1] < 0:
# need to keep top right
self.roll_type = 4
else:
# need to keep top left
self.roll_type = 3
break
if simulated_location[0] >= self.x_limit:
# on blue's left wall
self.squash_index = 0
# print(f"side wall recovery {self.agent.time}")
if simulated_velocity[1] < 0:
# need to keep top left
self.roll_type = 3
else:
# need to keep top right
self.roll_type = 4
break
if simulated_location[1] <= -self.y_limit:
# on blue's backboard
# print(f"back wall recovery {self.agent.time}")
if abs(simulated_location[0]) < 893:
if simulated_location[2] < 642:
self.roll_type = 1
self.squash_index = 2
break
self.squash_index = 1
if simulated_velocity[0] < 0:
# need to keep top left
self.roll_type = 3
else:
# need to keep top right
self.roll_type = 4
break
if simulated_location[1] >= self.y_limit:
# on orange's backboard
# print(f"side wall recovery {self.agent.time}")
if abs(simulated_location[0]) < 893:
if simulated_location[2] < 642:
self.roll_type = 1
self.squash_index = 2
break
self.squash_index = 1
if simulated_velocity[0] < 0:
# need to keep top right
self.roll_type = 4
else:
# need to keep top left
self.roll_type = 3
break
if simulated_time >= 10:
self.roll_type = 1
self.squash_index = 2
if self.aim_direction == None:
self.aim_direction = Vector([0, 0, -1])
self.collision_timer = simulated_time
self.collision_location = simulated_location
def update(self):
self.update_count -= 1
if self.update_count < 0:
self.run_simulation()
controller_state = self.get_controls()
if (
self.agent.onSurface
or self.agent.me.location[1] <= self.agent.recovery_height
):
self.active = False
# controller_state = SimpleControllerState()
return controller_state
# class DivineGrace(baseState): #mooonbots version
# def __init__(self, agent):
# self.agent = agent
# self.active = True
# # self.run_simulation()
# # print(f"default elevation is: {self.agent.defaultElevation}")
# self.x_limit = 4096 - self.agent.defaultElevation
# self.y_limit = 5120 - self.agent.defaultElevation
# self.ground_limit = self.agent.defaultElevation
# self.ceiling_limit = 2044 - self.agent.defaultElevation
# self.ideal_orientation = Vector([0, 0, 0])
# self.tick_length = 5
# self.squash_index = 0
# self.update_count = 0
# self.collision_timer = 0
# self.collision_location = Vector([0, 0, 0])
# self.aim_direction = None
# self.recovery_limit = 1
#
# def get_roll_value(self):
# if self.roll_type == 1:
# return turnController(
# -self.agent.me.rotation[2], self.agent.me.rotational_velocity[0] / 4
# ) # will make bot roll top up
#
# elif self.roll_type == 2:
# return turnController(
# self.agent.me.rotation[2], self.agent.me.rotational_velocity[0] / 4
# ) # will make bot roll top down
#
# elif self.roll_type == 3:
# return turnController(
# -(3.1415 / 2) - self.agent.me.rotation[2],
# self.agent.me.rotational_velocity[0] / 4,
# ) # will make bot roll top left
#
# elif self.roll_type == 4:
# return turnController(
# 3.1415 / 2 - self.agent.me.rotation[2],
# self.agent.me.rotational_velocity[0] / 4,
# ) # will make bot roll top right
#
# def get_controls(self):
# controller_state = SimpleControllerState()
#
# aim_vector = self.collision_location - self.agent.me.location
# if self.collision_timer <= self.recovery_limit:
# aim_vector.data[self.squash_index] = 0
#
# if self.aim_direction != None:
# if self.collision_timer > self.recovery_limit:
# aim_vector = (self.aim_direction + aim_vector.normalize()).normalize()
#
# aim_vector = aim_vector.normalize()
#
# align_car_to(controller_state, self.agent.me.avelocity, aim_vector, self.agent)
#
# # print(self.collision_timer)
# if self.collision_timer > self.recovery_limit:
# if self.agent._forward.dotProduct(aim_vector) > 0.7:
# if abs(self.agent.me.velocity[2]) < 1000 or self.agent.boostMonster:
# if self.agent.me.boostLevel > 20:
# controller_state.boost = True
#
# controller_state.throttle = 1
# controller_state.roll = self.get_roll_value()
# return controller_state
#
# def run_simulation(self):
# self.update_count = 5
# simulated_location = self.agent.me.location.scale(1)
# simulated_velocity = self.agent.me.velocity.scale(1)
# simulated_time = 0
# self.aim_direction = None
# while (
# simulated_time < 10
# ): # 0 gravity could lead to infinite loop! may want to add hard limiters
# simulated_velocity = simulated_velocity + Vector(
# [0, 0, self.agent.gravity]
# ).scale((self.agent.fakeDeltaTime) * self.tick_length)
# if simulated_velocity.magnitude() > 2300:
# simulated_velocity = simulated_velocity.normalize().scale(2300)
# simulated_location = simulated_location + simulated_velocity.scale(
# (self.agent.fakeDeltaTime) * self.tick_length
# )
# simulated_time += self.agent.fakeDeltaTime * self.tick_length
# if simulated_location[2] >= self.ceiling_limit:
# self.roll_type = 2
# self.squash_index = 2
# # print(f"ceiling recovery {self.agent.time}")
# self.aim_direction = Vector([0, 0, 1])
# break
# if simulated_location[2] <= self.ground_limit:
# self.roll_type = 1
# self.squash_index = 2
#
# # print(f"ground recovery {self.agent.time}")
# break
#
# if simulated_location[0] <= -self.x_limit:
# # on blue's right wall
# # print(f"side wall recovery {self.agent.time}")
# self.squash_index = 0
# if simulated_velocity[1] < 0:
# # need to keep top right
# self.roll_type = 4
#
# else:
# # need to keep top left
# self.roll_type = 3
# break
#
# if simulated_location[0] >= self.x_limit:
# # on blue's left wall
# self.squash_index = 0
# # print(f"side wall recovery {self.agent.time}")
# if simulated_velocity[1] < 0:
# # need to keep top left
# self.roll_type = 3
#
# else:
# # need to keep top right
# self.roll_type = 4
# break
#
# if simulated_location[1] <= -self.y_limit:
# # on blue's backboard
# # print(f"back wall recovery {self.agent.time}")
# if abs(simulated_location[0]) < 893:
# if simulated_location[2] < 642:
# self.roll_type = 1
# self.squash_index = 2
# break
# self.squash_index = 1
# if simulated_velocity[0] < 0:
# # need to keep top left
# self.roll_type = 3
#
# else:
# # need to keep top right
# self.roll_type = 4
# break
#
# if simulated_location[1] >= self.y_limit:
# # on orange's backboard
# # print(f"side wall recovery {self.agent.time}")
# if abs(simulated_location[0]) < 893:
# if simulated_location[2] < 642:
# self.roll_type = 1
# self.squash_index = 2
# break
# self.squash_index = 1
# if simulated_velocity[0] < 0:
# # need to keep top right
# self.roll_type = 4
#
# else:
# # need to keep top left
# self.roll_type = 3
# break
# if simulated_time >= 10:
# self.roll_type = 1
# self.squash_index = 2
#
# if self.aim_direction == None:
# self.aim_direction = Vector([0, 0, -1])
#
# self.collision_timer = simulated_time
# self.collision_location = simulated_location
#
# def update(self):
# self.update_count -= 1
# if self.update_count < 0:
# self.run_simulation()
# controller_state = self.get_controls()
# if (
# self.agent.onSurface
# or self.agent.me.location[1] <= self.agent.recovery_height
# ):
# self.active = False
#
# # controller_state = SimpleControllerState()
#
# return controller_state
class catchTesting(baseState):
def update(self):
return catch_ball(self.agent)
# class WardAgainstEvil(baseState):
# def __init__(self, agent):
# self.agent = agent
# self.active = True
# self.timeCreated = self.agent.time
#
# def update(self):
# # print(f"We're too scared! {self.agent.time}")
# return scaredyCat(self.agent)
class WardAgainstEvil(baseState):
def __init__(self, agent):
self.agent = agent
self.active = True
def update(self):
if goalie_shot(self.agent, self.agent.currentHit):
return ShellTime(self.agent)
else:
return gate(self.agent)
class BlessingOfDexterity(baseState):
def __init__(self, agent):
self.agent = agent
self.active = True
self.firstJump = False
self.secondJump = False
self.jumpStart = 0
self.timeCreated = self.agent.time
def update(self):
controller_state = SimpleControllerState()
controller_state.throttle = -1
if not self.firstJump:
controller_state.jump = True
controller_state.pitch = 1
self.firstJump = True
self.jumpStart = self.agent.time
return controller_state
elif self.firstJump and not self.secondJump:
jumpTimer = self.agent.time - self.jumpStart
controller_state.pitch = 1
controller_state.jump = False
if jumpTimer < 0.12:
controller_state.jump = True
if jumpTimer > 0.15:
controller_state.jump = True
self.jumpStart = self.agent.time
self.secondJump = True
return controller_state
elif self.firstJump and self.secondJump:
timer = self.agent.time - self.jumpStart
controller_state.throttle = 1
if timer < 0.15:
controller_state.pitch = 1
else:
controller_state.pitch = -1
controller_state.roll = 1
if timer > 0.8:
controller_state.roll = 0
if timer > 1.25:
self.active = False
return controller_state
else:
self.agent.log.append(
"halfFlip else conditional called in update. This should not be happening"
)
class Do_No_Evil(baseState):
def __init__(self, agent):
self.agent = agent
self.active = True
def update(self):
if self.agent.scorePred == None:
self.active = False
elif (
self.agent.scorePred.time - self.agent.time
) + 0.5 > self.agent.enemyBallInterceptDelay:
self.active = False
# print("B)")
return arrest_movement(self.agent)
class Chase(baseState):
def __init__(self, agent):
self.agent = agent
self.active = True
def update(self):
if not kickOffTest(self.agent):
return efficientMover(self.agent, self.agent.ball, self.agent.maxSpd)
else:
self.active = False
self.agent.activeState = PreemptiveStrike(self.agent)
return self.agent.activeState.update()
class HeetSeekerDefense(baseState):
def update(self):
return goFarPost(self.agent)
class Goalie(baseState):
def update(self):
distMin = 2000
if self.agent.ignore_kickoffs:
distMin = 3000
if (
distance2D(
Vector([0, 5200 * sign(self.agent.team), 0]), self.agent.ball.location
)
< distMin
or distance2D(
Vector([0, 5200 * sign(self.agent.team), 0]),
self.agent.currentHit.pred_vector,
)
< distMin
):
return ShellTime(self.agent)
offensive = sign(self.agent.team) * self.agent.ball.location[1] < 0
if offensive and self.agent.me.boostLevel < self.agent.boostThreshold:
return backmanBoostGrabber(self.agent)
return gate(self.agent, hurry=False)
class BlessingOfSafety(baseState):
def update(self):
distMin = 1500
offensive = sign(self.agent.team) * self.agent.ball.location[1] < 0
if self.agent.rotationNumber == 1:
return ShellTime(self.agent)
if (
distance2D(
Vector([0, 5200 * sign(self.agent.team), 0]), self.agent.ball.location
)
< distMin
or distance2D(
Vector([0, 5200 * sign(self.agent.team), 0]),
self.agent.currentHit.pred_vector,
)
< distMin
):
# return ShellTime(self.agent,retreat_enabled=self.agent.me.location == self.agent.lastMan) #retreat_enabled=self.agent.me.location != self.agent.lastMan
return ShellTime(self.agent)
else:
if self.agent.rotationNumber == 2:
# if len(self.agent.allies) == 1 and self.agent.team == 0:
# return playBack(self.agent, buffer=4500)
if len(self.agent.allies) > 0:
# if self.agent.team !=0 or self.agent.lastMan != self.agent.me.location:
if self.agent.lastMan != self.agent.me.location:
return secondManPositioning(self.agent)
else:
return thirdManPositioning(self.agent)
return playBack(self.agent)
else:
if len(self.agent.allies) > 0:
return thirdManPositioning(self.agent)
# return secondManPositioning(self.agent)
else:
return playBack(self.agent)
# catch case
return playBack(self.agent)
# def update(self):
# distMin = 1500
#
# offensive = sign(self.agent.team) * self.agent.ball.location[1] < 0
#
# if self.agent.rotationNumber == 1:
# return ShellTime(self.agent)
#
# if (
# (distance2D(
# Vector([0, 5200 * sign(self.agent.team), 0]), self.agent.ball.location
# )
# < distMin) or (distance2D(
# Vector([0, 5200 * sign(self.agent.team), 0]), self.agent.currentHit.pred_vector
# )
# < distMin)
# ):
# #return ShellTime(self.agent,retreat_enabled=self.agent.me.location == self.agent.lastMan) #retreat_enabled=self.agent.me.location != self.agent.lastMan
# return ShellTime(self.agent)
# else:
# if True:
# self.agent.wallShot = False
# if (self.agent.rotationNumber == 2):
# if len(self.agent.allies) > 0:
# #if self.agent.team !=0 or self.agent.lastMan != self.agent.me.location:
# if self.agent.lastMan != self.agent.me.location:
# return secondManPositioning(self.agent)
# else:
# return thirdManPositioning(self.agent)
# return playBack(self.agent,buffer = 4500)
# else:
# return thirdManPositioning(self.agent)
# def update(self):
# if self.agent.team == 0:
# return self.update_old()
#
# distMin = 2000
#
# offensive = self.agent.ball.location[1] * -sign(self.agent.team) > 1000
#
# if offensive:
# if self.agent.rotationNumber == 2:
# if self.agent.me.location[1] != self.agent.lastManY:
# return secondManPositioning(self.agent)
# else:
# if len(self.agent.allies) >= 2:
# return thirdManPositioning(self.agent)
# else:
# if self.agent.rotationNumber == 2:
# if self.agent.me.location[1] != self.agent.lastManY:
# return playBack(self.agent,buffer=2000)
# else:
# return playBack(self.agent, buffer=3500)
#
# return playBack(self.agent, buffer=3000)
class DivineAssistance(baseState):
def update(self):
return secondManSupport(self.agent)
def halfFlipStateManager(agent):
if agent.activeState.active == False:
agent.activeState = BlessingOfDexterity(agent)
else:
if type(agent.activeState) != BlessingOfDexterity:
agent.activeState = BlessingOfDexterity(agent)
class soloDefense(baseState):
def update(self):
if (
distance2D(
Vector([0, 5200 * sign(self.agent.team), 200]),
convertStructLocationToVector(self.agent.selectedBallPred),
)
< 1500
):
return ShellTime(self.agent)
else:
return playBack(self.agent)
class ScaleTheWalls(baseState):
def update(self):
return handleWallShot(self.agent)
class AngelicEmbrace(baseState):
def update(self):
# return carry_flick(self.agent,cradled = True)
return carry_flick_new(self.agent, cradled=True)
# return newCarry(self.agent)
class Holy_Shield(baseState):
def update(self):
return defensive_posture(self.agent)
class emergencyDefend(baseState):
def update(self):
penetrationPosition = convertStructLocationToVector(self.agent.goalPred)
penetrationPosition.data[1] = 5350 * sign(self.agent.team)
if self.agent.goalPred.game_seconds - self.agent.gameInfo.seconds_elapsed > 0.1:
if distance2D(self.agent.me.location, penetrationPosition) > 100:
return testMover(self.agent, penetrationPosition, 2300)
else:
if penetrationPosition[2] > 300:
self.activeState = LeapOfFaith(self.agent, -1)
return self.activeState.update()
else:
self.activeState = LeapOfFaith(self.agent, 0)
return self.activeState.update()
def parseCarInfo(carList, index, _max=False):
val = 0
best = None
for each in carList:
if _max:
if each[index] > val:
best = each
val = each[index]
else:
if each[index] < val:
best = each
val = each[index]
return best
def aerialStateManager(agent):
center = Vector([0, 5500 * -sign(agent.team), 200])
if agent.ball.location[2] < 110:
car_state = CarState(
physics=Physics(
velocity=Vector3(z=0, x=0, y=0), location=Vector3(0, 0, 17.1)
)
)
ball_state = BallState(
physics=Physics(
velocity=Vector3(
z=1550,
x=random.randrange(-1500, 1500),
y=random.randrange(-1500, 1500),
),
location=Vector3(0, 0, 350),
)
)
game_state = GameState(cars={agent.index: car_state}, ball=ball_state)
agent.set_game_state(game_state)
agent.activeState = None
if type(agent.activeState) != Wings_Of_Justice or not agent.activeState.active:
pred = agent.ballPred.slices[0]
for i in range(0, agent.ballPred.num_slices):
if i > 60 and i % 3 != 0:
continue
pred = agent.ballPred.slices[i]
tth = pred.game_seconds - agent.gameInfo.seconds_elapsed
if tth <= 0:
continue
if agent.onSurface:
if pred.physics.location.z < 300:
continue
pred_vec = convertStructLocationToVector(pred)
if findDistance(agent.me.location, pred_vec) < 2300 * tth:
_direction = direction(center, pred_vec).flatten()
positioningOffset = 90
aim_loc = pred_vec - _direction.scale(90)
tempAerial = Wings_Of_Justice(agent, pred, aim_loc, tth)
if tempAerial.active:
break
if tempAerial.active:
agent.activeState = tempAerial
def demoTest(agent):
targ = findEnemyClosestToLocation(agent, agent.ball.location)[0]
return demoEnemyCar(agent, targ)
def twos_manager(agent):
agentType = type(agent.activeState)
if agentType != PreemptiveStrike:
if not kickOffTest(agent):
myGoalLoc = Vector([0, 5200 * sign(agent.team), 200])
ballDistanceFromGoal = distance2D(myGoalLoc, agent.ball)
carDistanceFromGoal = distance2D(myGoalLoc, agent.me)
if agentType == LeapOfFaith:
if agent.activeState.active != False:
return
if agentType == Divine_Mandate:
if agent.activeState.active != False:
return
if agentType == airLaunch:
if agent.activeState.active != False:
return
if agentType == BlessingOfDexterity:
if agent.activeState.active != False:
return
if agentType == Wings_Of_Justice:
if agent.activeState.active != False:
return
if agentType == DivineGrace:
if agent.activeState.active != False:
return
if agentType == RighteousVolley:
if agent.activeState.active != False:
return
fastesthit = find_soonest_hit(agent)
hit = fastesthit
openNet = openGoalOpportunity(agent)
agent.openGoal = openNet
agent.timid = False
scared = False
tempDelay = hit.prediction_time - agent.gameInfo.seconds_elapsed
if tempDelay >= agent.enemyBallInterceptDelay - agent.contestedTimeLimit:
if agent.enemyAttacking:
agent.contested = True
if (
distance2D(hit.pred_vector, myGoalLoc) <= 2000
or distance2D(agent.enemyTargetVec, myGoalLoc) <= 2000
or ballDistanceFromGoal <= 2000
):
if agent.enemyAttacking:
agent.contested = True
agent.timid = False
scared = False
if hit.hit_type == 5:
if agentType != Wings_Of_Justice:
agent.activeState = hit.aerialState
return
if not agent.onSurface:
if agent.me.location[2] > agent.recovery_height:
if agentType != DivineGrace:
agent.activeState = DivineGrace(agent)
return
else:
agent.activeState = PreemptiveStrike(agent)
def team_synergy(agent):
agentType = type(agent.activeState)
if agentType != PreemptiveStrike:
if not kickOffTest(agent):
if locked_in(agent, agentType):
return
my_goal = Vector([0, 5200 * sign(agent.team), 200])
inclusive_team = agent.allies[:]
inclusive_team.append(agent.me)
inclusive_team = sorted(inclusive_team, key=lambda x: x.index)
ballDistanceFromGoal = distance2D(my_goal, agent.ball.location)
carDistanceFromGoal = distance2D(my_goal, agent.me.location)
current_ball_position = agent.ball.location
offensive = current_ball_position[1] * sign(agent.team) > 0
team_info = []
if agent.dribbling:
if agentType != AngelicEmbrace:
agent.activeState = AngelicEmbrace(agent)
return
for tm in inclusive_team:
# if agent.team == 1:
if tm.location[1] * sign(agent.team) > current_ball_position[1] * sign(
agent.team
):
dist = distance2D(tm.location, current_ball_position)
# if offensive:
# if player_retreat_status(tm,agent.team):
# dist+=1500
# if agent.ball.location[0] > 1000:
# if tm.location[0] >= agent.ball.location[0]:
# dist = clamp(dist, 0, dist - 1000)
# elif agent.ball.location[0] < -1000:
# if tm.location[0] <= agent.ball.location[0]:
# dist = clamp(dist, 0, dist - 1000)
else:
dist = distance2D(tm.location, my_goal) * 2
team_info.append((tm, dist))
rotations = sorted(team_info, key=lambda x: x[1])
if agent.me.location == rotations[0][0].location:
agent.rotationNumber = 1
elif agent.me.location == rotations[1][0].location:
agent.rotationNumber = 2
else:
agent.rotationNumber = 3
# if agent.hits[4] != None:
# print(f"agent {agent.index} found an aerial target! {agent.time}")
if agent.rotationNumber != 1 and agent.rotationNumber != 2:
if agent.hits[4] != None:
agent.currentHit = agent.hits[4]
agent.ballDelay = agent.currentHit.time_difference()
if agentType != Wings_Of_Justice:
agent.activeState = agent.hits[4].aerialState # .create_copy()
# agent.log.append(f"Going for aerial! {agent.time}")
return
agent.currentHit = find_soonest_hit(agent)
agent.ballDelay = agent.currentHit.time_difference()
if agentType == DivineGrace:
if agent.activeState.active != False:
return
if not agent.onSurface:
if agent.me.location[2] > agent.recovery_height:
if agentType != DivineGrace:
agent.activeState = DivineGrace(agent)
return
if agentType != BlessingOfSafety:
agent.activeState = BlessingOfSafety(agent)
return
boostOpportunity = inCornerWithBoost(agent)
if boostOpportunity != False:
if agent.me.boostLevel <= 50:
getBoost = False
if agent.team == 0:
if boostOpportunity[1] == 0 or boostOpportunity[1] == 1:
getBoost = True
else:
if boostOpportunity[1] == 2 or boostOpportunity[1] == 3:
getBoost = True
if getBoost:
if agentType != HeavenlyReprieve:
agent.activeState = HeavenlyReprieve(
agent, boostOpportunity[0]
)
return
if agent.rotationNumber == 2:
if agent.hits[4] != None:
agent.currentHit = agent.hits[4]
agent.ballDelay = agent.currentHit.time_difference()
if agentType != Wings_Of_Justice:
agent.activeState = agent.hits[4].aerialState # .create_copy()
# agent.log.append(f"Going for aerial! {agent.time}")
return
else:
agent.currentHit = find_soonest_hit(agent)
agent.ballDelay = agent.currentHit.time_difference()
if agentType == DivineGrace:
if agent.activeState.active != False:
return
if not agent.onSurface:
if agent.me.location[2] > agent.recovery_height:
if agentType != DivineGrace:
agent.activeState = DivineGrace(agent)
return
if agentType != BlessingOfSafety:
agent.activeState = BlessingOfSafety(agent)
return
fastesthit = find_soonest_hit(agent)
hit = fastesthit
openNet = openGoalOpportunity(agent)
agent.openGoal = openNet
tempDelay = hit.prediction_time - agent.gameInfo.seconds_elapsed
if tempDelay >= agent.enemyBallInterceptDelay - agent.contestedTimeLimit:
if agent.enemyAttacking:
agent.contested = True
if hit.hit_type == 5:
# print(f"going for aerial {agent.time}")
if agentType != Wings_Of_Justice:
agent.activeState = hit.aerialState # .create_copy()
# agent.log.append(f"Going for aerial! {agent.time}")
return
if agentType == DivineGrace:
if agent.activeState.active != False:
return
if not agent.onSurface:
if agent.me.location[2] > agent.recovery_height:
if agentType != DivineGrace:
agent.activeState = DivineGrace(agent)
return
if butterZone(hit.pred_vector):
agent.contested = True
agent.enemyAttacking = True
if agent.goalPred != None:
agent.contested = True
agent.enemyAttacking = True
goalward = ballHeadedTowardsMyGoal_testing(agent, hit)
agent.goalward = goalward
# if not agent.contested and not goalward:
# if hit.hit_type == 4:
# if agent.hits[1] != None:
# if not butterZone(hit.pred_vector):
# temptime = agent.hits[1].prediction_time - agent.time
# if (
# temptime
# < agent.enemyBallInterceptDelay
# - agent.contestedTimeLimit
# ):
# hit = agent.hits[1]
#
# elif hit.hit_type == 1:
# if agent.hits[0] != None:
# if not butterZone(hit.pred_vector):
# if agent.me.boostLevel > 30:
# temptime = agent.hits[0].prediction_time - agent.time
# if (
# temptime
# < agent.enemyBallInterceptDelay
# - agent.contestedTimeLimit
# ):
# hit = agent.hits[0]
if not agent.contested:
if hit.hit_type == 4:
if agent.hits[1] != None:
if hit.pred_vel[1] * -sign(agent.team) >= 1:
if not butterZone(hit.pred_vector):
temptime = agent.hits[1].prediction_time - agent.time
if (
temptime
< agent.enemyBallInterceptDelay
- agent.contestedTimeLimit
):
hit = agent.hits[1]
if hit.hit_type == 1:
if agent.hits[0] != None:
if agent.hits[0].pred_vel[1] * -sign(agent.team) >= 1:
if not butterZone(hit.pred_vector):
if agent.me.boostLevel > 30:
temptime = (
agent.hits[0].prediction_time - agent.time
)
if (
temptime
< agent.enemyBallInterceptDelay
- agent.contestedTimeLimit
):
hit = agent.hits[0]
if hit.hit_type == 5:
# print(f"going for aerial {agent.time}")
if agentType != Wings_Of_Justice:
agent.activeState = hit.aerialState # .create_copy()
# agent.log.append(f"Going for aerial! {agent.time}")
return
if carDistanceFromGoal > ballDistanceFromGoal:
if agentType != HolyProtector:
agent.activeState = HolyProtector(agent)
return
agent.currentHit = hit
agent.ballDelay = hit.prediction_time - agent.gameInfo.seconds_elapsed
# if agent.team == 1:
# catchViable = ballCatchViable(agent)
# else:
catchViable = False
if goalward:
if hit.hit_type != 2:
if agentType != HolyProtector:
agent.activeState = HolyProtector(agent)
return
else:
if agentType != ScaleTheWalls:
agent.activeState = ScaleTheWalls(agent)
return
else:
if catchViable:
if not agent.dribbling:
agent.currentHit = agent.hits[1]
agent.ballDelay = agent.currentHit.time_difference()
if agent.activeState != Celestial_Arrest:
agent.activeState = Celestial_Arrest(agent)
return
if hit.hit_type == 0: # hit.pred_vector[2] <= agent.groundCutOff:
if agentType != GroundAssault:
agent.activeState = GroundAssault(agent)
return
elif hit.hit_type == 1:
if agentType != HolyGrenade:
agent.activeState = HolyGrenade(agent)
return
elif hit.hit_type == 4:
if agentType != HolyGrenade:
agent.activeState = HolyGrenade(agent)
# print("would have been wallshot before")
return
elif hit.hit_type == 2:
if agentType != ScaleTheWalls:
agent.activeState = ScaleTheWalls(agent)
return
else:
agent.log.append(f"condition leaked through! {hit.hit_type}")
else:
agent.activeState = PreemptiveStrike(agent)
def newTeamStateManager(agent):
agentType = type(agent.activeState)
if (
agentType != PreemptiveStrike
or agentType == PreemptiveStrike
and not agent.activeState.active
):
if not kickOffTest(agent):
myGoalLoc = Vector([0, 5200 * sign(agent.team), 200])
enemyGoalLoc = Vector([0, 5200 * -sign(agent.team), 200])
ballDistanceFromGoal = distance2D(myGoalLoc, agent.ball.location)
carDistanceFromGoal = distance2D(myGoalLoc, agent.me.location)
if locked_in(agent, agentType):
return
fastesthit = agent.sorted_hits[0] # find_soonest_hit(agent)
hit = fastesthit
if (
hit.hit_type == 2
and abs(agent.me.location[1]) > 5100
and len(agent.sorted_hits) > 1
):
fastesthit = agent.sorted_hits[1]
hit = fastesthit
if hit.hit_type == 5:
if agent.enemyBallInterceptDelay + 0.5 < hit.time_difference():
if agent.onSurface:
if len(agent.sorted_hits) > 1:
hit = agent.sorted_hits[1]
openNet = openGoalOpportunity(agent)
agent.openGoal = openNet
agent.timid = False
scared = False
tempDelay = hit.prediction_time - agent.gameInfo.seconds_elapsed
if tempDelay >= agent.enemyBallInterceptDelay - agent.contestedTimeLimit:
if agent.enemyAttacking:
agent.contested = True
if agent.goalPred != None:
agent.contested = True
agent.enemyAttacking = True
if butterZone(hit.pred_vector):
agent.contested = True
agent.enemyAttacking = True
if hit.hit_type == 5:
if not agent.onSurface:
if agentType != Wings_Of_Justice:
agent.activeState = hit.aerialState # .create_copy()
return
if agentType == DivineGrace:
if agent.activeState.active != False:
return
if not agent.onSurface:
if agent.me.location[2] > agent.recovery_height:
if agentType != DivineGrace:
agent.activeState = DivineGrace(agent)
return
lastMan = agent.lastMan
catchViable = False
inclusive_team = agent.allies[:]
inclusive_team.append(agent.me)
inclusive_team = sorted(inclusive_team, key=lambda x: x.index)
offensive = agent.ball.location[1] * -sign(agent.team) > 0
if agent.team == 5:
if (
not agent.gameInfo.is_round_active
or agent.gameInfo.is_kickoff_pause
):
man = 2
else:
rotations = prototype_rotations(agent)
man = clamp(3, 1, rotations.index(agent.index) + 1)
agent.rotationNumber = man
agent.boostThreshhold = man * 25
else:
if (
not agent.gameInfo.is_round_active
or agent.gameInfo.is_kickoff_pause
):
man = 2
agent.currentHit = fastesthit
agent.ballDelay = fastesthit.time_difference()
if agentType != Kickoff_Boosties:
agent.activeState = Kickoff_Boosties(agent)
return
else:
man = 1
if agent.me.location[1] * sign(agent.team) < hit.pred_vector[
1
] * sign(agent.team):
if agent.me.location != lastMan:
# if hit.pred_vector[1] * sign(agent.time) < 4000:
man = len(agent.allies) + 1
if offensive:
if retreating_tally(agent.allies) != len(agent.allies):
if agent.me.retreating:
if agent.me.location != lastMan:
if distance2D(hit.pred_vector, myGoalLoc) > 2000:
man = len(agent.allies) + 1
if man != len(agent.allies) + 1:
myDist = weighted_distance_2D(
agent.me.location, agent.ball.location
)
for ally in agent.allies:
if not ally.demolished:
if ally.location[1] * sign(
agent.team
) > agent.ball.location[1] * sign(agent.team):
allyDist = weighted_distance_2D(
ally.location, agent.ball.location
)
if allyDist < myDist:
if not ally.retreating:
man += 1
man = clamp(3, 1, man)
if len(agent.enemies) < 4 and not agent.contested and hit.hit_type != 5:
# if not agent.contested and agent.lastMan != agent.me.location and man == 1 and hit.hit_type != 0 and agent.goalPred == None and not ballHeadedTowardsMyGoal_testing(agent, hit) and not agent.ignore_kickoffs:# and agent.team == 1:
chrono_hits = agent.sorted_hits
prev_hit = hit
for h in chrono_hits:
if ballHeadedTowardsMyGoal_testing(agent, h):
break
if distance2D(h.pred_vector, enemyGoalLoc) >= distance2D(
agent.me.location, enemyGoalLoc
):
break
if h.pred_vel[1] * -sign(agent.team) >= 1 and h.hit_type != 5:
if not butterZone(prev_hit.pred_vector):
temptime = h.time_difference()
if (
temptime
< agent.enemyBallInterceptDelay
- agent.contestedTimeLimit
):
hit = h
if (
agent.onWall
and hit.hit_type == 2
or hit.hit_type == 0
or butterZone(hit.pred_vector)
):
agent.ballDelay = hit.time_difference()
break
else:
break
else:
break
prev_hit = h
hit = prev_hit
agent.ballDelay = hit.time_difference()
if man == 2:
if agent.lastMan != agent.me.location:
if hit.pred_vector[1] * -sign(agent.team) > 4000 * -sign(
agent.team and len(agent.allies) > 1
):
if butterZone(hit.pred_vector):
if hit.time_difference() < agent.enemyBallInterceptDelay or (
hit.time_difference() < 2
and agent.lastMan[1] * sign(agent.team) > 0
):
man = 1
agent.log.append(
f"risking it for the biscuit! {agent.time} {agent.team}"
)
agent.rotationNumber = man
goalward = ballHeadedTowardsMyGoal_testing(agent, hit)
agent.goalward = goalward
agent.currentHit = hit
agent.ballDelay = hit.time_difference()
agent.ballGrounded = False
if hit.hit_type == 2:
agent.wallShot = True
agent.ballGrounded = False
else:
agent.wallShot = False
if hit.hit_type == 1:
if hit.pred_vector[2] <= agent.groundCutOff:
agent.ballGrounded = True
else:
agent.ballGrounded = False
createBox(agent, hit.pred_vector)
if agent.dribbling:
if agentType != AngelicEmbrace:
agent.activeState = AngelicEmbrace(agent)
return
boostOpportunity = inCornerWithBoost(agent)
if boostOpportunity != False:
if agent.me.boostLevel <= 50:
getBoost = False
if agent.team == 0:
if boostOpportunity[1] == 0 or boostOpportunity[1] == 1:
getBoost = True
else:
if boostOpportunity[1] == 2 or boostOpportunity[1] == 3:
getBoost = True
if getBoost:
if agentType != HeavenlyReprieve:
agent.activeState = HeavenlyReprieve(
agent, boostOpportunity[0]
)
return
if agent.ignore_kickoffs:
if distance2D(hit.pred_vector, myGoalLoc) > 3000:
if agent.activeState != HeetSeekerDefense:
agent.activeState = HeetSeekerDefense(agent)
return
if agent.goalie:
if agent.activeState != Goalie:
agent.activeState = Goalie(agent)
return
if man == 1:
if catchViable:
if not agent.dribbling:
# if agent.hits[1].pred_vel[1] * -sign(agent.team) >= 1:
agent.currentHit = agent.hits[1]
agent.ballDelay = agent.currentHit.time_difference()
if agent.activeState != Celestial_Arrest:
agent.activeState = Celestial_Arrest(agent)
return
if carDistanceFromGoal > ballDistanceFromGoal:
if agentType != HolyProtector:
agent.activeState = HolyProtector(agent)
return
# if agent.contested and agent.enemyBallInterceptDelay +.2 < hit.time_difference() and agent.goalPred == None:
# if agent.team == 1:
# if agentType != Holy_Shield:
# agent.activeState = Holy_Shield(agent)
# return
if goalward:
if hit.hit_type != 2:
if agentType != HolyProtector:
agent.activeState = HolyProtector(agent)
return
else:
if agentType != ScaleTheWalls:
agent.activeState = ScaleTheWalls(agent)
return
else:
if hit.hit_type == 0: # hit.pred_vector[2] <= agent.groundCutOff:
if agentType != GroundAssault:
agent.activeState = GroundAssault(agent)
return
elif hit.hit_type == 1:
if agentType != HolyGrenade:
agent.activeState = HolyGrenade(agent)
return
elif hit.hit_type == 4:
if agentType != HolyGrenade:
agent.activeState = HolyGrenade(agent)
# print("would have been wallshot before")
return
elif hit.hit_type == 2:
if agentType != ScaleTheWalls:
agent.activeState = ScaleTheWalls(agent)
return
elif hit.hit_type == 5:
if agentType != Wings_Of_Justice:
agent.activeState = hit.aerialState # .create_copy()
# agent.log.append(f"Going for aerial! {agent.time}")
return
else:
agent.log.append(f"condition leaked through! {hit.hit_type}")
else:
if agentType != BlessingOfSafety:
agent.activeState = BlessingOfSafety(agent)
return
else:
agent.activeState = PreemptiveStrike(agent)
def team_manager(agent):
agentType = type(agent.activeState)
if (
agentType != PreemptiveStrike
or agentType == PreemptiveStrike
and not agent.activeState.active
):
if not kickOffTest(agent):
myGoalLoc = Vector([0, 5200 * sign(agent.team), 200])
enemyGoalLoc = Vector([0, 5200 * -sign(agent.team), 200])
ballDistanceFromGoal = distance2D(myGoalLoc, agent.ball.location)
carDistanceFromGoal = distance2D(myGoalLoc, agent.me.location)
if locked_in(agent, agentType):
return
fastesthit = agent.sorted_hits[0] # find_soonest_hit(agent)
hit = fastesthit
if hit.hit_type == 5:
if agent.enemyBallInterceptDelay + 0.5 < hit.time_difference():
if agent.onSurface:
if len(agent.sorted_hits) > 1:
hit = agent.sorted_hits[1]
openNet = openGoalOpportunity(agent)
agent.openGoal = openNet
agent.timid = False
scared = False
tempDelay = hit.prediction_time - agent.gameInfo.seconds_elapsed
# if not agent.dribbling:
# agent.enemyAttacking = True
if tempDelay >= agent.enemyBallInterceptDelay - agent.contestedTimeLimit:
# if agent.enemyAttacking or agent.team == 0:
agent.contested = True
# agent.enemyAttacking = True
if agent.goalPred != None:
agent.contested = True
agent.enemyAttacking = True
if butterZone(hit.pred_vector):
agent.contested = True
agent.enemyAttacking = True
if hit.hit_type == 5:
# print(f"going for aerial {agent.time}")
if not agent.onSurface:
if agentType != Wings_Of_Justice:
agent.activeState = hit.aerialState # .create_copy()
# agent.log.append(f"Going for aerial! {agent.time}")
return
if agentType == DivineGrace:
if agent.activeState.active != False:
return
if not agent.onSurface:
if agent.me.location[2] > agent.recovery_height:
if agentType != DivineGrace:
agent.activeState = DivineGrace(agent)
return
lastMan = agent.lastMan
catchViable = False
inclusive_team = agent.allies[:]
inclusive_team.append(agent.me)
inclusive_team = sorted(inclusive_team, key=lambda x: x.index)
offensive = agent.ball.location[1] * -sign(agent.team) > 0
if not agent.gameInfo.is_round_active or agent.gameInfo.is_kickoff_pause:
man = 2
else:
man = 1
hit_timers = [
[
fastesthit.prediction_time,
agent.me.retreating
or agent.me.location[1] * sign(agent.team)
< fastesthit.pred_vector[1] * sign(agent.team),
]
]
if agent.ally_hit_count == 0:
ally_hits = []
for i in range(len(agent.allies)):
agent.allies[i].next_hit = find_ally_hit(agent, agent.allies[i])
hit_timers.append(
[
agent.allies[i].next_hit.time,
agent.allies[i].retreating
or agent.allies[i].location[1] * sign(agent.team)
< agent.allies[i].next_hit.location[1]
* sign(agent.team),
]
)
ally_hits.append(
[
agent.allies[i].next_hit.time,
agent.allies[i].retreating
or agent.allies[i].location[1] * sign(agent.team)
< agent.allies[i].next_hit.location[1]
* sign(agent.team),
]
)
agent.ally_hit_info = ally_hits
else:
hit_timers = hit_timers + agent.ally_hit_info
agent.ally_hit_count += 1
if agent.ally_hit_count > 3:
agent.ally_hit_count = 0
sorted_team_hits = sorted(hit_timers, key=lambda x: x[0])
for index, th in enumerate(sorted_team_hits[:]):
if th[1]:
sorted_team_hits.append(th)
sorted_team_hits = sorted_team_hits[1:]
for i in range(len(sorted_team_hits)):
if (
sorted_team_hits[i][0] < fastesthit.prediction_time
or not sorted_team_hits[i][1]
and agent.me.retreating
):
man += 1
# print(sorted_team_hits[i][0],fastesthit.prediction_time)
man = clamp(3, 1, man)
agent.boostThreshhold = man * 25
# if not agent.contested and agent.goalPred == None and len(agent.allies) < 2:
if False: # or (agent.team == 1 and not agent.contested):
# if not agent.contested and agent.lastMan != agent.me.location and man == 1 and hit.hit_type != 0 and agent.goalPred == None and not ballHeadedTowardsMyGoal_testing(agent, hit) and not agent.ignore_kickoffs:# and agent.team == 1:
chrono_hits = agent.sorted_hits
prev_hit = hit
for h in chrono_hits:
# if h.time_difference() < 1:
# break
if h.hit_type == 5:
continue
if distance2D(h.pred_vector, enemyGoalLoc) >= distance2D(
agent.me.location, enemyGoalLoc
):
break
if h.pred_vel[1] * -sign(agent.team) >= 1:
if not butterZone(prev_hit.pred_vector):
temptime = h.time_difference()
if (
temptime
< agent.enemyBallInterceptDelay
- agent.contestedTimeLimit
):
hit = h
else:
break
else:
break
prev_hit = h
hit = prev_hit
agent.ballDelay = hit.time_difference()
if man == 2:
if agent.lastMan != agent.me.location:
if hit.pred_vector[1] * -sign(agent.team) > 4000 * -sign(
agent.team and len(agent.allies) > 1
):
if butterZone(hit.pred_vector):
if hit.time_difference() < agent.enemyBallInterceptDelay or (
hit.time_difference() < 2
and agent.lastMan[1] * sign(agent.team) > 0
):
man = 1
agent.log.append(
f"risking it for the biscuit! {agent.time} {agent.team}"
)
agent.rotationNumber = man
goalward = ballHeadedTowardsMyGoal_testing(agent, hit)
agent.goalward = goalward
agent.currentHit = hit
agent.ballDelay = hit.time_difference()
agent.ballGrounded = False
if hit.hit_type == 2:
agent.wallShot = True
agent.ballGrounded = False
else:
agent.wallShot = False
if hit.hit_type == 1:
if hit.pred_vector[2] <= agent.groundCutOff:
agent.ballGrounded = True
else:
agent.ballGrounded = False
createBox(agent, hit.pred_vector)
if agent.dribbling:
if agentType != AngelicEmbrace:
agent.activeState = AngelicEmbrace(agent)
return
boostOpportunity = inCornerWithBoost(agent)
if boostOpportunity != False:
if agent.me.boostLevel <= 50:
getBoost = False
if agent.team == 0:
if boostOpportunity[1] == 0 or boostOpportunity[1] == 1:
getBoost = True
else:
if boostOpportunity[1] == 2 or boostOpportunity[1] == 3:
getBoost = True
if getBoost:
if agentType != HeavenlyReprieve:
agent.activeState = HeavenlyReprieve(
agent, boostOpportunity[0]
)
return
if agent.ignore_kickoffs:
if distance2D(hit.pred_vector, myGoalLoc) > 3000:
if agent.activeState != HeetSeekerDefense:
agent.activeState = HeetSeekerDefense(agent)
return
if agent.goalie:
if agent.activeState != Goalie:
agent.activeState = Goalie(agent)
return
if man == 1:
if catchViable:
if not agent.dribbling:
# if agent.hits[1].pred_vel[1] * -sign(agent.team) >= 1:
agent.currentHit = agent.hits[1]
agent.ballDelay = agent.currentHit.time_difference()
if agent.activeState != Celestial_Arrest:
agent.activeState = Celestial_Arrest(agent)
return
if carDistanceFromGoal > ballDistanceFromGoal:
if agentType != HolyProtector:
agent.activeState = HolyProtector(agent)
return
# if agent.contested and agent.enemyBallInterceptDelay +.2 < hit.time_difference() and agent.goalPred == None:
# if agent.team == 1:
# if agentType != Holy_Shield:
# agent.activeState = Holy_Shield(agent)
# return
if goalward:
if hit.hit_type != 2:
if agentType != HolyProtector:
agent.activeState = HolyProtector(agent)
return
else:
if agentType != ScaleTheWalls:
agent.activeState = ScaleTheWalls(agent)
return
else:
if hit.hit_type == 0: # hit.pred_vector[2] <= agent.groundCutOff:
if agentType != GroundAssault:
agent.activeState = GroundAssault(agent)
return
elif hit.hit_type == 1:
if agentType != HolyGrenade:
agent.activeState = HolyGrenade(agent)
return
elif hit.hit_type == 4:
if agentType != HolyGrenade:
agent.activeState = HolyGrenade(agent)
# print("would have been wallshot before")
return
elif hit.hit_type == 2:
if agentType != ScaleTheWalls:
agent.activeState = ScaleTheWalls(agent)
return
elif hit.hit_type == 5:
if agentType != Wings_Of_Justice:
agent.activeState = hit.aerialState # .create_copy()
# agent.log.append(f"Going for aerial! {agent.time}")
return
else:
agent.log.append(f"condition leaked through! {hit.hit_type}")
else:
# if agent.team == 0:
# if agent.ball.location[1] * sign(agent.team) >= 0:
# if agent.lastMan == agent.me.location:
# if agentType != WardAgainstEvil:
# agent.activeState = WardAgainstEvil(agent)
# return
if agentType != BlessingOfSafety:
agent.activeState = BlessingOfSafety(agent)
return
else:
agent.activeState = PreemptiveStrike(agent)
def soloStateManager(agent):
agentType = type(agent.activeState)
if agentType != PreemptiveStrike:
if not kickOffTest(agent):
myGoalLoc = Vector([0, 5200 * sign(agent.team), 200])
ballDistanceFromGoal = distance2D(myGoalLoc, agent.ball)
carDistanceFromGoal = distance2D(myGoalLoc, agent.me)
enemyGoalLoc = Vector([0, 5200 * -sign(agent.team), 200])
# agent.resetTimer += agent.deltaTime
if agentType == LeapOfFaith:
if agent.activeState.active != False:
return
if agentType == airLaunch:
if agent.activeState.active != False:
return
if agentType == BlessingOfDexterity:
if agent.activeState.active != False:
return
if agentType == DivineGrace:
if agent.activeState.active != False:
return
if agentType == RighteousVolley:
if agent.activeState.active != False:
return
hit = find_soonest_hit(agent)
openNet = openGoalOpportunity(agent)
agent.openGoal = openNet
agent.timid = False
scared = False
tempDelay = hit.prediction_time - agent.time
# print(tempDelay)
if tempDelay >= agent.enemyBallInterceptDelay - 0.5:
if agent.enemyAttacking:
agent.contested = True
if tempDelay >= agent.enemyBallInterceptDelay + 1:
if not butterZone(hit.pred_vector):
if ballDistanceFromGoal <= 5000:
agent.timid = True
else:
scared = True
# print(tempDelay,agent.enemyBallInterceptDelay)
# pass
if (
distance2D(hit.pred_vector, myGoalLoc) <= 2000
or distance2D(agent.enemyTargetVec, myGoalLoc) <= 2000
):
agent.contested = True
agent.timid = False
scared = False
# if not agent.contested or not agent.enemyAttacking:
# if agent.hits[0] != None:
# temptime = (
# agent.hits[0].prediction_time - agent.gameInfo.seconds_elapsed
# )
# # if temptime >=1:
# if hit.hit_type != 2:
# # if temptime < agent.enemyBallInterceptDelay - .5:
# hit = agent.hits[0]
# if False:
if not agent.contested:
chrono_hits = agent.sorted_hits
prev_hit = hit
for h in chrono_hits:
if h.time_difference() < 1:
break
if h.hit_type == 5:
continue
if distance2D(h.pred_vector, enemyGoalLoc) >= distance2D(
agent.me.location, enemyGoalLoc
):
break
if h.pred_vel[1] * -sign(agent.team) >= 1:
if not butterZone(prev_hit.pred_vector):
temptime = h.time_difference()
if (
temptime
< agent.enemyBallInterceptDelay
- agent.contestedTimeLimit
):
hit = h
else:
break
else:
break
prev_hit = h
hit = prev_hit
agent.ballDelay = hit.time_difference()
goalward = ballHeadedTowardsMyGoal_testing(agent, hit)
agent.goalward = goalward
agent.currentHit = hit
agent.ballDelay = hit.prediction_time - agent.time
agent.ballGrounded = False
# print(agent.ballDelay, agent.enemyBallInterceptDelay,agent.contested,agent.timid)
if hit.hit_type == 2:
agent.wallShot = True
agent.ballGrounded = False
else:
agent.wallShot = False
if hit.hit_type == 1:
if hit.pred_vector[2] <= agent.groundCutOff:
agent.ballGrounded = True
else:
agent.ballGrounded = False
createBox(agent, hit.pred_vector)
if agentType == Wings_Of_Justice:
if agent.activeState.active != False:
return
if not agent.onSurface:
if agent.me.location[2] > agent.recovery_height:
if agentType != DivineGrace:
agent.activeState = DivineGrace(agent)
return
if agent.dribbling:
if not goalward:
if agentType != AngelicEmbrace:
agent.activeState = AngelicEmbrace(agent)
return
# else:
# agent.resetTimer += agent.deltaTime
# if agent.resetTimer >= 5:
# agent.resetTimer = 0
# print("setting up dribble training")
# #game_state = GameState()
# #self.set_game_state(game_state)
# ball_state = BallState(Physics(location=Vector3(agent.me.location[0], agent.me.location[1], agent.me.location[2]+160),velocity=Vector3(agent.me.velocity[0],agent.me.velocity[1],agent.me.velocity[2])))
# game_state = GameState(ball=ball_state)
# agent.set_game_state(game_state)
# if agentType != AngelicEmbrace:
# agent.activeState = AngelicEmbrace(agent)
# return
# if agent.timid or scared:
# #print(f"being timid {agent.time}")
# if agentType != WardAgainstEvil:
# agent.activeState = WardAgainstEvil(agent)
# return
# if scared or agent.timid:
# if agentType != BlessingOfSafety:
# agent.activeState = BlessingOfSafety(agent)
# return
if carDistanceFromGoal > ballDistanceFromGoal:
if agentType != HolyProtector:
agent.activeState = HolyProtector(agent)
return
elif goalward:
if hit.hit_type != 2:
if agentType != HolyProtector:
agent.activeState = HolyProtector(agent)
return
else:
if agentType != ScaleTheWalls:
agent.activeState = ScaleTheWalls(agent)
# print("scaling walls")
# print(f"scale the walls defensive {agent.time}")
return
else:
if hit.hit_type == 0:
if agentType != GroundAssault:
agent.activeState = GroundAssault(agent)
return
elif hit.hit_type == 1:
if agentType != HolyGrenade:
agent.activeState = HolyGrenade(agent)
return
elif hit.hit_type == 2:
if agentType != ScaleTheWalls:
agent.activeState = ScaleTheWalls(agent)
return
else:
agent.log.append("we got an eroneous hit_type somehow")
agent.log.append("rawr")
else:
agent.activeState = PreemptiveStrike(agent)
def soloStateManager_testing(agent):
agentType = type(agent.activeState)
if (
agentType != PreemptiveStrike
or agentType == PreemptiveStrike
and not agent.activeState.active
):
if not kickOffTest(agent):
myGoalLoc = Vector([0, 5200 * sign(agent.team), 200])
enemyGoalLoc = Vector([0, 5200 * -sign(agent.team), 200])
ballDistanceFromGoal = distance2D(myGoalLoc, agent.ball)
carDistanceFromGoal = distance2D(myGoalLoc, agent.me)
# agent.resetTimer += agent.deltaTime
if locked_in(agent, agentType):
return
hit = agent.sorted_hits[0] # find_soonest_hit(agent)
openNet = openGoalOpportunity(agent)
agent.openGoal = openNet
agent.timid = False
scared = False
tempDelay = hit.time_difference()
offensive = hit.pred_vector[1] * sign(agent.team) < 0
if tempDelay >= agent.enemyBallInterceptDelay:
if agent.enemyAttacking:
agent.contested = True
if (
tempDelay > agent.enemyBallInterceptDelay and offensive
): # and agent.me.boostLevel < agent.boostThreshold:
if (
findDistance(agent.ball.location, agent.me.location) > 600
): # and not extendToGoal(agent,hit.pred_vector,agent.me.location):
scared = True
if (
distance2D(hit.pred_vector, myGoalLoc) <= 2000
or distance2D(agent.enemyTargetVec, myGoalLoc) <= 2000
or ballDistanceFromGoal <= 2000
):
if (
agent.enemyAttacking
): # or agent.me.velocity[1] * sign(agent.team) > 1:
agent.contested = True
agent.timid = False
scared = False
if agent.goalPred != None:
agent.contested = True
scared = False
if hit.hit_type == 5:
if not agent.onSurface:
if agentType != Wings_Of_Justice:
agent.activeState = hit.aerialState # .create_copy()
print(f" aerial is accepted... {agent.time}")
return
else:
if agent.sorted_hits[1] != None:
hit = agent.sorted_hits[1]
if agentType == Do_No_Evil:
if agent.activeState.active:
return
if (
not agent.contested
and not butterZone(hit.pred_vector)
and not ballHeadedTowardsMyGoal_testing(agent, hit)
):
chrono_hits = agent.sorted_hits
prev_hit = hit
for h in chrono_hits:
if ballHeadedTowardsMyGoal_testing(agent, h):
break
if h.hit_type == 5:
continue
if h.pred_vel[1] * -sign(agent.team) >= 1:
# current_butter = butterZone(h.pred_vector) and h.pred_vector[1] * sign(agent.team) < 0
temptime = h.time_difference()
if (
temptime
< agent.enemyBallInterceptDelay - agent.contestedTimeLimit
) or not agent.enemyAttacking:
hit = h
if (
agent.onWall
and hit.hit_type == 2
or hit.hit_type == 0
or butterZone(hit.pred_vector)
):
agent.ballDelay = hit.time_difference()
break
else:
break
prev_hit = h
goalward = ballHeadedTowardsMyGoal_testing(agent, hit)
agent.goalward = goalward
agent.currentHit = hit
agent.ballDelay = hit.prediction_time - agent.time
catchViable = False # ballCatchViable(agent)# and agent.team == 1
if hit.hit_type == 2:
agent.wallShot = True
else:
agent.wallShot = False
createBox(agent, hit.pred_vector)
if hit.hit_type == 5:
if agentType != Wings_Of_Justice:
agent.activeState = hit.aerialState
return
if not agent.onSurface:
if agent.me.location[2] > agent.recovery_height:
if agentType != DivineGrace:
agent.activeState = DivineGrace(agent)
return
if agent.dribbling:
# if not goalward:
if agentType != AngelicEmbrace:
agent.activeState = AngelicEmbrace(agent)
return
# if scared and agent.team == 0:
# if scared:
# if agent.activeState != BlessingOfSafety:
# agent.activeState = BlessingOfSafety(agent)
# # print(f"We scared! {agent.time}")
# return
if agent.scorePred != None:
if (
clamp(
15000,
0.0001,
findDistance(
agent.closestEnemyToBall.location, agent.scorePred.location
)
- 150,
)
/ 2300
> agent.scorePred.time - agent.time
):
if (
(agent.scorePred.time - agent.time) + 0.5
< agent.enemyBallInterceptDelay
and (agent.scorePred.time - agent.time) < 4.5
and not agent.dribbling
and not agent.closestEnemyToBall.demolished
):
# if agent.team == 1:
agent.activeState = Do_No_Evil(agent)
return
if agent.enemyBallInterceptDelay > agent.scorePred.time - agent.time:
if agent.activeState != BlessingOfSafety:
agent.activeState = BlessingOfSafety(agent)
return
boostOpportunity = inCornerWithBoost(agent)
if boostOpportunity != False:
if agent.me.boostLevel <= 50:
getBoost = False
if agent.team == 0:
if boostOpportunity[1] == 0 or boostOpportunity[1] == 1:
getBoost = True
else:
if boostOpportunity[1] == 2 or boostOpportunity[1] == 3:
getBoost = True
if getBoost:
if agentType != HeavenlyReprieve:
agent.activeState = HeavenlyReprieve(
agent, boostOpportunity[0]
)
return
if agent.goalie:
if agent.activeState != Goalie:
agent.activeState = Goalie(agent)
return
if agent.ignore_kickoffs:
if distance2D(hit.pred_vector, myGoalLoc) > 3000:
if agent.activeState != HeetSeekerDefense:
agent.activeState = HeetSeekerDefense(agent)
return
if carDistanceFromGoal > ballDistanceFromGoal:
if agentType != HolyProtector:
agent.activeState = HolyProtector(agent)
return
if goalward:
if hit.hit_type != 2:
if agentType != HolyProtector:
agent.activeState = HolyProtector(agent)
return
else:
if agentType != ScaleTheWalls:
agent.activeState = ScaleTheWalls(agent)
return
else:
# if hit.hit_type == 0: #hit.pred_vector[2] <= agent.groundCutOff:
# if agentType != GroundAssault:
# agent.activeState = GroundAssault(agent)
# return
#
# elif hit.hit_type == 1 or hit.hit_type == 4:
# if agentType != HolyGrenade:
# agent.activeState = HolyGrenade(agent)
# return
#
# else:
# if agentType != ScaleTheWalls:
# agent.activeState = ScaleTheWalls(agent)
# return
if catchViable:
# if agent.team == 1:
hit = agent.hits[1]
goalward = False
agent.goalward = False
agent.currentHit = hit
agent.ballDelay = hit.prediction_time - agent.time
agent.ballGrounded = False
if agent.activeState != Celestial_Arrest:
agent.activeState = Celestial_Arrest(agent)
print(f"catching? {agent.time}")
agent.log.append(f"catching? {agent.time}")
return
if hit.hit_type == 0: # hit.pred_vector[2] <= agent.groundCutOff:
if agentType != GroundAssault:
agent.activeState = GroundAssault(agent)
return
elif hit.hit_type == 1:
if agentType != HolyGrenade:
agent.activeState = HolyGrenade(agent)
return
elif hit.hit_type == 4:
if agentType != HolyGrenade:
agent.activeState = HolyGrenade(agent)
# print("would have been wallshot before")
return
elif hit.hit_type == 2:
if agentType != ScaleTheWalls:
agent.activeState = ScaleTheWalls(agent)
return
else:
agent.log.append(f"condition leaked through! {hit.hit_type}")
else:
agent.activeState = PreemptiveStrike(agent)
def guidanceTesting(agent):
# print("in guidance testing")
if type(agent.activeState) != DivineGuidance:
agent.activeState = DivineGuidance(agent, agent.ball.location)
if agent.onSurface:
if not agent.activeState.active:
agent.activeState = DivineGuidance(agent, agent.ball.location)
# def aerialTesting(agent):
# if agent.activeState == None or not agent.activeState.active:
# center = Vector([0, 5200 * -sign(agent.team), 0])
# _offset = agent.reachLength
#
# picked = agent.ballPred.slices[agent.ballPred.num_slices-1]
# pred = agent.ballPred.slices[0]
# selected = False
# for i in range(0, agent.ballPred.num_slices):
# if i > 60 and i % 3 != 0:
# continue
#
# pred = agent.ballPred.slices[i]
# tth = pred.game_seconds - agent.gameInfo.seconds_elapsed
#
# if tth <= 0:
# continue
# pred_vec = convertStructLocationToVector(pred)
# pred_vel = convertStructVelocityToVector(pred)
#
# _direction = direction(
# pred_vec, center.flatten()
# )
#
# target = pred_vec + _direction.scale(agent.reachLength * 0.9)
# req_delta_a = calculate_delta_acceleration(target-agent.me.location, agent.me.velocity,
# tth, agent.gravity)
# req_delta_v = req_delta_a.magnitude()*tth
# if req_delta_v < agent.available_delta_v and req_delta_a.magnitude() < 1060:
# agent.activeState = Wings_Of_Justice(agent,pred, target, tth)
# selected = True
# break
# if not selected:
# agent.activeState = Wings_Of_Justice(agent, picked, convertStructLocationToVector(picked), 6)
def reset_aerial_test(agent):
ball_state = BallState(
physics=Physics(
velocity=Vector3(
z=random.randrange(500, 1000),
x=random.randrange(-100, 100),
y=random.randrange(-100, 100),
),
location=Vector3(
random.randrange(-100, 100),
random.randrange(-100, 100),
random.randrange(1200, 1750),
),
)
)
car_state = CarState(
physics=Physics(
velocity=Vector3(z=1000, x=0, y=0),
location=Vector3(
random.randrange(-1500, 1500),
sign(agent.team) * random.randrange(1500, 2500),
100,
),
rotation=agent.defaultRotation,
)
)
game_state = GameState(ball=ball_state, cars={agent.index: car_state})
agent.set_game_state(game_state)
agent.activeState = None
def aerialTesting(agent):
if agent.ball.location[2] < 110:
reset_aerial_test(agent)
if agent.activeState == None or not agent.activeState.active:
center = Vector([0, 5200 * -sign(agent.team), 0])
_offset = agent.reachLength
picked = agent.ballPred.slices[agent.ballPred.num_slices - 1]
pred = agent.ballPred.slices[0]
selected = False
for i in range(0, agent.ballPred.num_slices):
if i > 60 and i % 3 != 0:
continue
pred = agent.ballPred.slices[i]
tth = pred.game_seconds - agent.gameInfo.seconds_elapsed
if tth <= 0:
continue
pred_vec = convertStructLocationToVector(pred)
pred_vel = convertStructVelocityToVector(pred)
if pred_vec[2] < 600:
break
_direction = direction(pred_vec, center.flatten())
target = pred_vec + _direction.scale(agent.reachLength * 0.25)
aerial_accepted = False
if agent.onSurface:
# if (inaccurateArrivalEstimator(agent, pred_vec, False, offset=_offset) + 1 < tth):
delta_a = calculate_delta_acceleration(
target - agent.me.location,
agent.me.velocity + agent.up.scale(600),
tth,
agent.gravity,
)
if delta_a.magnitude() <= 900:
aerial_accepted = True
else:
approach_direction = direction(
agent.me.location.flatten(), pred_vec.flatten()
).normalize()
pseudo_position = pred_vec.flatten() - approach_direction.scale(
pred_vec[2]
)
req_delta_a = calculate_delta_acceleration(
pseudo_position - agent.me.location,
approach_direction.scale(1800) + agent.up.scale(500),
tth,
agent.gravity,
)
req_delta_v = req_delta_a.magnitude() * tth
if (
req_delta_v < agent.available_delta_v - 50
and req_delta_a.magnitude() < 1000
):
aerial_accepted = True
else:
delta_a = calculate_delta_acceleration(
target - agent.me.location, agent.me.velocity, tth, agent.gravity
)
if delta_a.magnitude() < 950:
req_delta_v = delta_a.magnitude() * tth
if req_delta_v < agent.available_delta_v - 50:
aerial_accepted = True
if aerial_accepted:
agent.activeState = Wings_Of_Justice(agent, pred, target, tth)
selected = True
break
if not selected:
# agent.activeState = Wings_Of_Justice(agent, picked, convertStructLocationToVector(picked), 6)
agent.activeState = DivineGrace(agent)
def dribbleTesting(agent):
agent.activeState = AngelicEmbrace(agent)
if agent.dribbling:
return
else:
agent.resetTimer += agent.deltaTime
if agent.resetTimer >= 5:
agent.resetTimer = 0
agent.log.append("setting up dribble training")
# game_state = GameState()
# self.set_game_state(game_state)
ball_state = BallState(
Physics(
location=Vector3(
agent.me.location[0],
agent.me.location[1],
agent.me.location[2] + 160,
),
velocity=Vector3(
agent.me.velocity[0] * 0.95,
agent.me.velocity[1] * 0.95,
agent.me.velocity[2],
),
)
)
game_state = GameState(ball=ball_state)
agent.set_game_state(game_state)
# if agentType != AngelicEmbrace:
# agent.activeState = AngelicEmbrace(agent)
return
def orientationStateManager(agent):
if agent.ball.location < 110:
agent.log.append("resetting orientations")
car_state = CarState(
physics=Physics(velocity=Vector3(z=0, x=0, y=0), location=Vector3(0, 0, 20))
)
game_state = GameState(cars={agent.index: car_state})
agent.set_game_state(game_state)
if agent.dribbling:
if type(agent.activeState) != AngelicEmbrace:
agent.activeState = AngelicEmbrace(agent)
return
else:
agent.activeState
# return agent.activeState
def dummyState(agent):
if type(agent.activeState) != Player_reporter:
agent.activeState = Player_reporter(agent)
| 37.227332
| 246
| 0.501169
| 16,221
| 172,437
| 5.219407
| 0.046236
| 0.072392
| 0.01793
| 0.019749
| 0.808443
| 0.761693
| 0.734244
| 0.701337
| 0.682628
| 0.661533
| 0
| 0.025264
| 0.415126
| 172,437
| 4,631
| 247
| 37.23537
| 0.814207
| 0.161688
| 0
| 0.723533
| 0
| 0.000605
| 0.006469
| 0.001188
| 0
| 0
| 0
| 0
| 0
| 1
| 0.03176
| false
| 0.000302
| 0.001815
| 0.003932
| 0.121597
| 0.00121
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a74126eceee0e97f36e2476a01cb78c7b5f4037e
| 356,526
|
py
|
Python
|
src/windows/RMF_HDF5.py
|
salilab/rmf_chimerax
|
c744866f3bc8777a9aae56d9eee5bf2b0fce3419
|
[
"MIT"
] | null | null | null |
src/windows/RMF_HDF5.py
|
salilab/rmf_chimerax
|
c744866f3bc8777a9aae56d9eee5bf2b0fce3419
|
[
"MIT"
] | null | null | null |
src/windows/RMF_HDF5.py
|
salilab/rmf_chimerax
|
c744866f3bc8777a9aae56d9eee5bf2b0fce3419
|
[
"MIT"
] | null | null | null |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg = __name__.rpartition('.')[0]
mname = '.'.join((pkg, '_RMF_HDF5')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_RMF_HDF5')
_RMF_HDF5 = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_RMF_HDF5', [dirname(__file__)])
except ImportError:
import _RMF_HDF5
return _RMF_HDF5
try:
_mod = imp.load_module('_RMF_HDF5', fp, pathname, description)
finally:
if fp is not None:
fp.close()
return _mod
_RMF_HDF5 = swig_import_helper()
del swig_import_helper
else:
import _RMF_HDF5
del _swig_python_version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except __builtin__.Exception:
class _object:
pass
_newclass = 0
class RMF_HDF5_SwigPyIterator(_object):
"""Proxy of C++ swig::RMF_HDF5_SwigPyIterator class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, RMF_HDF5_SwigPyIterator, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, RMF_HDF5_SwigPyIterator, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _RMF_HDF5.delete_RMF_HDF5_SwigPyIterator
__del__ = lambda self: None
def value(self):
"""value(RMF_HDF5_SwigPyIterator self) -> PyObject *"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator_value(self)
def incr(self, n=1):
"""
incr(RMF_HDF5_SwigPyIterator self, size_t n=1) -> RMF_HDF5_SwigPyIterator
incr(RMF_HDF5_SwigPyIterator self) -> RMF_HDF5_SwigPyIterator
"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator_incr(self, n)
def decr(self, n=1):
"""
decr(RMF_HDF5_SwigPyIterator self, size_t n=1) -> RMF_HDF5_SwigPyIterator
decr(RMF_HDF5_SwigPyIterator self) -> RMF_HDF5_SwigPyIterator
"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator_decr(self, n)
def distance(self, x):
"""distance(RMF_HDF5_SwigPyIterator self, RMF_HDF5_SwigPyIterator x) -> ptrdiff_t"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator_distance(self, x)
def equal(self, x):
"""equal(RMF_HDF5_SwigPyIterator self, RMF_HDF5_SwigPyIterator x) -> bool"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator_equal(self, x)
def copy(self):
"""copy(RMF_HDF5_SwigPyIterator self) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator_copy(self)
def next(self):
"""next(RMF_HDF5_SwigPyIterator self) -> PyObject *"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator_next(self)
def __next__(self):
"""__next__(RMF_HDF5_SwigPyIterator self) -> PyObject *"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator___next__(self)
def previous(self):
"""previous(RMF_HDF5_SwigPyIterator self) -> PyObject *"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator_previous(self)
def advance(self, n):
"""advance(RMF_HDF5_SwigPyIterator self, ptrdiff_t n) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator_advance(self, n)
def __eq__(self, x):
"""__eq__(RMF_HDF5_SwigPyIterator self, RMF_HDF5_SwigPyIterator x) -> bool"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator___eq__(self, x)
def __ne__(self, x):
"""__ne__(RMF_HDF5_SwigPyIterator self, RMF_HDF5_SwigPyIterator x) -> bool"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator___ne__(self, x)
def __iadd__(self, n):
"""__iadd__(RMF_HDF5_SwigPyIterator self, ptrdiff_t n) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator___iadd__(self, n)
def __isub__(self, n):
"""__isub__(RMF_HDF5_SwigPyIterator self, ptrdiff_t n) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator___isub__(self, n)
def __add__(self, n):
"""__add__(RMF_HDF5_SwigPyIterator self, ptrdiff_t n) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator___add__(self, n)
def __sub__(self, *args):
"""
__sub__(RMF_HDF5_SwigPyIterator self, ptrdiff_t n) -> RMF_HDF5_SwigPyIterator
__sub__(RMF_HDF5_SwigPyIterator self, RMF_HDF5_SwigPyIterator x) -> ptrdiff_t
"""
return _RMF_HDF5.RMF_HDF5_SwigPyIterator___sub__(self, *args)
def __iter__(self):
return self
RMF_HDF5_SwigPyIterator_swigregister = _RMF_HDF5.RMF_HDF5_SwigPyIterator_swigregister
RMF_HDF5_SwigPyIterator_swigregister(RMF_HDF5_SwigPyIterator)
RMF_VERSION_MAJOR = _RMF_HDF5.RMF_VERSION_MAJOR
RMF_VERSION_MINOR = _RMF_HDF5.RMF_VERSION_MINOR
RMF_HAS_LOG4CXX = _RMF_HDF5.RMF_HAS_LOG4CXX
RMF_HAS_DEPRECATED_BACKENDS = _RMF_HDF5.RMF_HAS_DEPRECATED_BACKENDS
RMF_COMPILER_HAS_OVERRIDE = _RMF_HDF5.RMF_COMPILER_HAS_OVERRIDE
RMF_COMPILER_HAS_FINAL = _RMF_HDF5.RMF_COMPILER_HAS_FINAL
RMF_HAS_NOEXCEPT = _RMF_HDF5.RMF_HAS_NOEXCEPT
_types_list=[]
def get_data_types():
return _types_list
class Ints(_object):
"""Proxy of C++ std::vector<(int)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Ints, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Ints, name)
__repr__ = _swig_repr
def iterator(self):
"""iterator(Ints self) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.Ints_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
"""__nonzero__(Ints self) -> bool"""
return _RMF_HDF5.Ints___nonzero__(self)
def __bool__(self):
"""__bool__(Ints self) -> bool"""
return _RMF_HDF5.Ints___bool__(self)
def __len__(self):
"""__len__(Ints self) -> std::vector< int >::size_type"""
return _RMF_HDF5.Ints___len__(self)
def __getslice__(self, i, j):
"""__getslice__(Ints self, std::vector< int >::difference_type i, std::vector< int >::difference_type j) -> Ints"""
return _RMF_HDF5.Ints___getslice__(self, i, j)
def __setslice__(self, *args):
"""
__setslice__(Ints self, std::vector< int >::difference_type i, std::vector< int >::difference_type j)
__setslice__(Ints self, std::vector< int >::difference_type i, std::vector< int >::difference_type j, Ints v)
"""
return _RMF_HDF5.Ints___setslice__(self, *args)
def __delslice__(self, i, j):
"""__delslice__(Ints self, std::vector< int >::difference_type i, std::vector< int >::difference_type j)"""
return _RMF_HDF5.Ints___delslice__(self, i, j)
def __delitem__(self, *args):
"""
__delitem__(Ints self, std::vector< int >::difference_type i)
__delitem__(Ints self, PySliceObject * slice)
"""
return _RMF_HDF5.Ints___delitem__(self, *args)
def __getitem__(self, *args):
"""
__getitem__(Ints self, PySliceObject * slice) -> Ints
__getitem__(Ints self, std::vector< int >::difference_type i) -> std::vector< int >::value_type const &
"""
return _RMF_HDF5.Ints___getitem__(self, *args)
def __setitem__(self, *args):
"""
__setitem__(Ints self, PySliceObject * slice, Ints v)
__setitem__(Ints self, PySliceObject * slice)
__setitem__(Ints self, std::vector< int >::difference_type i, std::vector< int >::value_type const & x)
"""
return _RMF_HDF5.Ints___setitem__(self, *args)
def pop(self):
"""pop(Ints self) -> std::vector< int >::value_type"""
return _RMF_HDF5.Ints_pop(self)
def append(self, x):
"""append(Ints self, std::vector< int >::value_type const & x)"""
return _RMF_HDF5.Ints_append(self, x)
def empty(self):
"""empty(Ints self) -> bool"""
return _RMF_HDF5.Ints_empty(self)
def size(self):
"""size(Ints self) -> std::vector< int >::size_type"""
return _RMF_HDF5.Ints_size(self)
def swap(self, v):
"""swap(Ints self, Ints v)"""
return _RMF_HDF5.Ints_swap(self, v)
def begin(self):
"""begin(Ints self) -> std::vector< int >::iterator"""
return _RMF_HDF5.Ints_begin(self)
def end(self):
"""end(Ints self) -> std::vector< int >::iterator"""
return _RMF_HDF5.Ints_end(self)
def rbegin(self):
"""rbegin(Ints self) -> std::vector< int >::reverse_iterator"""
return _RMF_HDF5.Ints_rbegin(self)
def rend(self):
"""rend(Ints self) -> std::vector< int >::reverse_iterator"""
return _RMF_HDF5.Ints_rend(self)
def clear(self):
"""clear(Ints self)"""
return _RMF_HDF5.Ints_clear(self)
def get_allocator(self):
"""get_allocator(Ints self) -> std::vector< int >::allocator_type"""
return _RMF_HDF5.Ints_get_allocator(self)
def pop_back(self):
"""pop_back(Ints self)"""
return _RMF_HDF5.Ints_pop_back(self)
def erase(self, *args):
"""
erase(Ints self, std::vector< int >::iterator pos) -> std::vector< int >::iterator
erase(Ints self, std::vector< int >::iterator first, std::vector< int >::iterator last) -> std::vector< int >::iterator
"""
return _RMF_HDF5.Ints_erase(self, *args)
def __init__(self, *args):
"""
__init__(std::vector<(int)> self) -> Ints
__init__(std::vector<(int)> self, Ints arg2) -> Ints
__init__(std::vector<(int)> self, std::vector< int >::size_type size) -> Ints
__init__(std::vector<(int)> self, std::vector< int >::size_type size, std::vector< int >::value_type const & value) -> Ints
"""
this = _RMF_HDF5.new_Ints(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def push_back(self, x):
"""push_back(Ints self, std::vector< int >::value_type const & x)"""
return _RMF_HDF5.Ints_push_back(self, x)
def front(self):
"""front(Ints self) -> std::vector< int >::value_type const &"""
return _RMF_HDF5.Ints_front(self)
def back(self):
"""back(Ints self) -> std::vector< int >::value_type const &"""
return _RMF_HDF5.Ints_back(self)
def assign(self, n, x):
"""assign(Ints self, std::vector< int >::size_type n, std::vector< int >::value_type const & x)"""
return _RMF_HDF5.Ints_assign(self, n, x)
def resize(self, *args):
"""
resize(Ints self, std::vector< int >::size_type new_size)
resize(Ints self, std::vector< int >::size_type new_size, std::vector< int >::value_type const & x)
"""
return _RMF_HDF5.Ints_resize(self, *args)
def insert(self, *args):
"""
insert(Ints self, std::vector< int >::iterator pos, std::vector< int >::value_type const & x) -> std::vector< int >::iterator
insert(Ints self, std::vector< int >::iterator pos, std::vector< int >::size_type n, std::vector< int >::value_type const & x)
"""
return _RMF_HDF5.Ints_insert(self, *args)
def reserve(self, n):
"""reserve(Ints self, std::vector< int >::size_type n)"""
return _RMF_HDF5.Ints_reserve(self, n)
def capacity(self):
"""capacity(Ints self) -> std::vector< int >::size_type"""
return _RMF_HDF5.Ints_capacity(self)
__swig_destroy__ = _RMF_HDF5.delete_Ints
__del__ = lambda self: None
Ints_swigregister = _RMF_HDF5.Ints_swigregister
Ints_swigregister(Ints)
class Floats(_object):
"""Proxy of C++ std::vector<(float)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Floats, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Floats, name)
__repr__ = _swig_repr
def iterator(self):
"""iterator(Floats self) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.Floats_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
"""__nonzero__(Floats self) -> bool"""
return _RMF_HDF5.Floats___nonzero__(self)
def __bool__(self):
"""__bool__(Floats self) -> bool"""
return _RMF_HDF5.Floats___bool__(self)
def __len__(self):
"""__len__(Floats self) -> std::vector< float >::size_type"""
return _RMF_HDF5.Floats___len__(self)
def __getslice__(self, i, j):
"""__getslice__(Floats self, std::vector< float >::difference_type i, std::vector< float >::difference_type j) -> Floats"""
return _RMF_HDF5.Floats___getslice__(self, i, j)
def __setslice__(self, *args):
"""
__setslice__(Floats self, std::vector< float >::difference_type i, std::vector< float >::difference_type j)
__setslice__(Floats self, std::vector< float >::difference_type i, std::vector< float >::difference_type j, Floats v)
"""
return _RMF_HDF5.Floats___setslice__(self, *args)
def __delslice__(self, i, j):
"""__delslice__(Floats self, std::vector< float >::difference_type i, std::vector< float >::difference_type j)"""
return _RMF_HDF5.Floats___delslice__(self, i, j)
def __delitem__(self, *args):
"""
__delitem__(Floats self, std::vector< float >::difference_type i)
__delitem__(Floats self, PySliceObject * slice)
"""
return _RMF_HDF5.Floats___delitem__(self, *args)
def __getitem__(self, *args):
"""
__getitem__(Floats self, PySliceObject * slice) -> Floats
__getitem__(Floats self, std::vector< float >::difference_type i) -> std::vector< float >::value_type const &
"""
return _RMF_HDF5.Floats___getitem__(self, *args)
def __setitem__(self, *args):
"""
__setitem__(Floats self, PySliceObject * slice, Floats v)
__setitem__(Floats self, PySliceObject * slice)
__setitem__(Floats self, std::vector< float >::difference_type i, std::vector< float >::value_type const & x)
"""
return _RMF_HDF5.Floats___setitem__(self, *args)
def pop(self):
"""pop(Floats self) -> std::vector< float >::value_type"""
return _RMF_HDF5.Floats_pop(self)
def append(self, x):
"""append(Floats self, std::vector< float >::value_type const & x)"""
return _RMF_HDF5.Floats_append(self, x)
def empty(self):
"""empty(Floats self) -> bool"""
return _RMF_HDF5.Floats_empty(self)
def size(self):
"""size(Floats self) -> std::vector< float >::size_type"""
return _RMF_HDF5.Floats_size(self)
def swap(self, v):
"""swap(Floats self, Floats v)"""
return _RMF_HDF5.Floats_swap(self, v)
def begin(self):
"""begin(Floats self) -> std::vector< float >::iterator"""
return _RMF_HDF5.Floats_begin(self)
def end(self):
"""end(Floats self) -> std::vector< float >::iterator"""
return _RMF_HDF5.Floats_end(self)
def rbegin(self):
"""rbegin(Floats self) -> std::vector< float >::reverse_iterator"""
return _RMF_HDF5.Floats_rbegin(self)
def rend(self):
"""rend(Floats self) -> std::vector< float >::reverse_iterator"""
return _RMF_HDF5.Floats_rend(self)
def clear(self):
"""clear(Floats self)"""
return _RMF_HDF5.Floats_clear(self)
def get_allocator(self):
"""get_allocator(Floats self) -> std::vector< float >::allocator_type"""
return _RMF_HDF5.Floats_get_allocator(self)
def pop_back(self):
"""pop_back(Floats self)"""
return _RMF_HDF5.Floats_pop_back(self)
def erase(self, *args):
"""
erase(Floats self, std::vector< float >::iterator pos) -> std::vector< float >::iterator
erase(Floats self, std::vector< float >::iterator first, std::vector< float >::iterator last) -> std::vector< float >::iterator
"""
return _RMF_HDF5.Floats_erase(self, *args)
def __init__(self, *args):
"""
__init__(std::vector<(float)> self) -> Floats
__init__(std::vector<(float)> self, Floats arg2) -> Floats
__init__(std::vector<(float)> self, std::vector< float >::size_type size) -> Floats
__init__(std::vector<(float)> self, std::vector< float >::size_type size, std::vector< float >::value_type const & value) -> Floats
"""
this = _RMF_HDF5.new_Floats(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def push_back(self, x):
"""push_back(Floats self, std::vector< float >::value_type const & x)"""
return _RMF_HDF5.Floats_push_back(self, x)
def front(self):
"""front(Floats self) -> std::vector< float >::value_type const &"""
return _RMF_HDF5.Floats_front(self)
def back(self):
"""back(Floats self) -> std::vector< float >::value_type const &"""
return _RMF_HDF5.Floats_back(self)
def assign(self, n, x):
"""assign(Floats self, std::vector< float >::size_type n, std::vector< float >::value_type const & x)"""
return _RMF_HDF5.Floats_assign(self, n, x)
def resize(self, *args):
"""
resize(Floats self, std::vector< float >::size_type new_size)
resize(Floats self, std::vector< float >::size_type new_size, std::vector< float >::value_type const & x)
"""
return _RMF_HDF5.Floats_resize(self, *args)
def insert(self, *args):
"""
insert(Floats self, std::vector< float >::iterator pos, std::vector< float >::value_type const & x) -> std::vector< float >::iterator
insert(Floats self, std::vector< float >::iterator pos, std::vector< float >::size_type n, std::vector< float >::value_type const & x)
"""
return _RMF_HDF5.Floats_insert(self, *args)
def reserve(self, n):
"""reserve(Floats self, std::vector< float >::size_type n)"""
return _RMF_HDF5.Floats_reserve(self, n)
def capacity(self):
"""capacity(Floats self) -> std::vector< float >::size_type"""
return _RMF_HDF5.Floats_capacity(self)
__swig_destroy__ = _RMF_HDF5.delete_Floats
__del__ = lambda self: None
Floats_swigregister = _RMF_HDF5.Floats_swigregister
Floats_swigregister(Floats)
class Strings(_object):
"""Proxy of C++ std::vector<(std::string)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Strings, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Strings, name)
__repr__ = _swig_repr
def iterator(self):
"""iterator(Strings self) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.Strings_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
"""__nonzero__(Strings self) -> bool"""
return _RMF_HDF5.Strings___nonzero__(self)
def __bool__(self):
"""__bool__(Strings self) -> bool"""
return _RMF_HDF5.Strings___bool__(self)
def __len__(self):
"""__len__(Strings self) -> std::vector< std::string >::size_type"""
return _RMF_HDF5.Strings___len__(self)
def __getslice__(self, i, j):
"""__getslice__(Strings self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j) -> Strings"""
return _RMF_HDF5.Strings___getslice__(self, i, j)
def __setslice__(self, *args):
"""
__setslice__(Strings self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j)
__setslice__(Strings self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j, Strings v)
"""
return _RMF_HDF5.Strings___setslice__(self, *args)
def __delslice__(self, i, j):
"""__delslice__(Strings self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j)"""
return _RMF_HDF5.Strings___delslice__(self, i, j)
def __delitem__(self, *args):
"""
__delitem__(Strings self, std::vector< std::string >::difference_type i)
__delitem__(Strings self, PySliceObject * slice)
"""
return _RMF_HDF5.Strings___delitem__(self, *args)
def __getitem__(self, *args):
"""
__getitem__(Strings self, PySliceObject * slice) -> Strings
__getitem__(Strings self, std::vector< std::string >::difference_type i) -> std::vector< std::string >::value_type const &
"""
return _RMF_HDF5.Strings___getitem__(self, *args)
def __setitem__(self, *args):
"""
__setitem__(Strings self, PySliceObject * slice, Strings v)
__setitem__(Strings self, PySliceObject * slice)
__setitem__(Strings self, std::vector< std::string >::difference_type i, std::vector< std::string >::value_type const & x)
"""
return _RMF_HDF5.Strings___setitem__(self, *args)
def pop(self):
"""pop(Strings self) -> std::vector< std::string >::value_type"""
return _RMF_HDF5.Strings_pop(self)
def append(self, x):
"""append(Strings self, std::vector< std::string >::value_type const & x)"""
return _RMF_HDF5.Strings_append(self, x)
def empty(self):
"""empty(Strings self) -> bool"""
return _RMF_HDF5.Strings_empty(self)
def size(self):
"""size(Strings self) -> std::vector< std::string >::size_type"""
return _RMF_HDF5.Strings_size(self)
def swap(self, v):
"""swap(Strings self, Strings v)"""
return _RMF_HDF5.Strings_swap(self, v)
def begin(self):
"""begin(Strings self) -> std::vector< std::string >::iterator"""
return _RMF_HDF5.Strings_begin(self)
def end(self):
"""end(Strings self) -> std::vector< std::string >::iterator"""
return _RMF_HDF5.Strings_end(self)
def rbegin(self):
"""rbegin(Strings self) -> std::vector< std::string >::reverse_iterator"""
return _RMF_HDF5.Strings_rbegin(self)
def rend(self):
"""rend(Strings self) -> std::vector< std::string >::reverse_iterator"""
return _RMF_HDF5.Strings_rend(self)
def clear(self):
"""clear(Strings self)"""
return _RMF_HDF5.Strings_clear(self)
def get_allocator(self):
"""get_allocator(Strings self) -> std::vector< std::string >::allocator_type"""
return _RMF_HDF5.Strings_get_allocator(self)
def pop_back(self):
"""pop_back(Strings self)"""
return _RMF_HDF5.Strings_pop_back(self)
def erase(self, *args):
"""
erase(Strings self, std::vector< std::string >::iterator pos) -> std::vector< std::string >::iterator
erase(Strings self, std::vector< std::string >::iterator first, std::vector< std::string >::iterator last) -> std::vector< std::string >::iterator
"""
return _RMF_HDF5.Strings_erase(self, *args)
def __init__(self, *args):
"""
__init__(std::vector<(std::string)> self) -> Strings
__init__(std::vector<(std::string)> self, Strings arg2) -> Strings
__init__(std::vector<(std::string)> self, std::vector< std::string >::size_type size) -> Strings
__init__(std::vector<(std::string)> self, std::vector< std::string >::size_type size, std::vector< std::string >::value_type const & value) -> Strings
"""
this = _RMF_HDF5.new_Strings(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def push_back(self, x):
"""push_back(Strings self, std::vector< std::string >::value_type const & x)"""
return _RMF_HDF5.Strings_push_back(self, x)
def front(self):
"""front(Strings self) -> std::vector< std::string >::value_type const &"""
return _RMF_HDF5.Strings_front(self)
def back(self):
"""back(Strings self) -> std::vector< std::string >::value_type const &"""
return _RMF_HDF5.Strings_back(self)
def assign(self, n, x):
"""assign(Strings self, std::vector< std::string >::size_type n, std::vector< std::string >::value_type const & x)"""
return _RMF_HDF5.Strings_assign(self, n, x)
def resize(self, *args):
"""
resize(Strings self, std::vector< std::string >::size_type new_size)
resize(Strings self, std::vector< std::string >::size_type new_size, std::vector< std::string >::value_type const & x)
"""
return _RMF_HDF5.Strings_resize(self, *args)
def insert(self, *args):
"""
insert(Strings self, std::vector< std::string >::iterator pos, std::vector< std::string >::value_type const & x) -> std::vector< std::string >::iterator
insert(Strings self, std::vector< std::string >::iterator pos, std::vector< std::string >::size_type n, std::vector< std::string >::value_type const & x)
"""
return _RMF_HDF5.Strings_insert(self, *args)
def reserve(self, n):
"""reserve(Strings self, std::vector< std::string >::size_type n)"""
return _RMF_HDF5.Strings_reserve(self, n)
def capacity(self):
"""capacity(Strings self) -> std::vector< std::string >::size_type"""
return _RMF_HDF5.Strings_capacity(self)
__swig_destroy__ = _RMF_HDF5.delete_Strings
__del__ = lambda self: None
Strings_swigregister = _RMF_HDF5.Strings_swigregister
Strings_swigregister(Strings)
class Doubles(_object):
"""Proxy of C++ std::vector<(double)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Doubles, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Doubles, name)
__repr__ = _swig_repr
def iterator(self):
"""iterator(Doubles self) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.Doubles_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
"""__nonzero__(Doubles self) -> bool"""
return _RMF_HDF5.Doubles___nonzero__(self)
def __bool__(self):
"""__bool__(Doubles self) -> bool"""
return _RMF_HDF5.Doubles___bool__(self)
def __len__(self):
"""__len__(Doubles self) -> std::vector< double >::size_type"""
return _RMF_HDF5.Doubles___len__(self)
def __getslice__(self, i, j):
"""__getslice__(Doubles self, std::vector< double >::difference_type i, std::vector< double >::difference_type j) -> Doubles"""
return _RMF_HDF5.Doubles___getslice__(self, i, j)
def __setslice__(self, *args):
"""
__setslice__(Doubles self, std::vector< double >::difference_type i, std::vector< double >::difference_type j)
__setslice__(Doubles self, std::vector< double >::difference_type i, std::vector< double >::difference_type j, Doubles v)
"""
return _RMF_HDF5.Doubles___setslice__(self, *args)
def __delslice__(self, i, j):
"""__delslice__(Doubles self, std::vector< double >::difference_type i, std::vector< double >::difference_type j)"""
return _RMF_HDF5.Doubles___delslice__(self, i, j)
def __delitem__(self, *args):
"""
__delitem__(Doubles self, std::vector< double >::difference_type i)
__delitem__(Doubles self, PySliceObject * slice)
"""
return _RMF_HDF5.Doubles___delitem__(self, *args)
def __getitem__(self, *args):
"""
__getitem__(Doubles self, PySliceObject * slice) -> Doubles
__getitem__(Doubles self, std::vector< double >::difference_type i) -> std::vector< double >::value_type const &
"""
return _RMF_HDF5.Doubles___getitem__(self, *args)
def __setitem__(self, *args):
"""
__setitem__(Doubles self, PySliceObject * slice, Doubles v)
__setitem__(Doubles self, PySliceObject * slice)
__setitem__(Doubles self, std::vector< double >::difference_type i, std::vector< double >::value_type const & x)
"""
return _RMF_HDF5.Doubles___setitem__(self, *args)
def pop(self):
"""pop(Doubles self) -> std::vector< double >::value_type"""
return _RMF_HDF5.Doubles_pop(self)
def append(self, x):
"""append(Doubles self, std::vector< double >::value_type const & x)"""
return _RMF_HDF5.Doubles_append(self, x)
def empty(self):
"""empty(Doubles self) -> bool"""
return _RMF_HDF5.Doubles_empty(self)
def size(self):
"""size(Doubles self) -> std::vector< double >::size_type"""
return _RMF_HDF5.Doubles_size(self)
def swap(self, v):
"""swap(Doubles self, Doubles v)"""
return _RMF_HDF5.Doubles_swap(self, v)
def begin(self):
"""begin(Doubles self) -> std::vector< double >::iterator"""
return _RMF_HDF5.Doubles_begin(self)
def end(self):
"""end(Doubles self) -> std::vector< double >::iterator"""
return _RMF_HDF5.Doubles_end(self)
def rbegin(self):
"""rbegin(Doubles self) -> std::vector< double >::reverse_iterator"""
return _RMF_HDF5.Doubles_rbegin(self)
def rend(self):
"""rend(Doubles self) -> std::vector< double >::reverse_iterator"""
return _RMF_HDF5.Doubles_rend(self)
def clear(self):
"""clear(Doubles self)"""
return _RMF_HDF5.Doubles_clear(self)
def get_allocator(self):
"""get_allocator(Doubles self) -> std::vector< double >::allocator_type"""
return _RMF_HDF5.Doubles_get_allocator(self)
def pop_back(self):
"""pop_back(Doubles self)"""
return _RMF_HDF5.Doubles_pop_back(self)
def erase(self, *args):
"""
erase(Doubles self, std::vector< double >::iterator pos) -> std::vector< double >::iterator
erase(Doubles self, std::vector< double >::iterator first, std::vector< double >::iterator last) -> std::vector< double >::iterator
"""
return _RMF_HDF5.Doubles_erase(self, *args)
def __init__(self, *args):
"""
__init__(std::vector<(double)> self) -> Doubles
__init__(std::vector<(double)> self, Doubles arg2) -> Doubles
__init__(std::vector<(double)> self, std::vector< double >::size_type size) -> Doubles
__init__(std::vector<(double)> self, std::vector< double >::size_type size, std::vector< double >::value_type const & value) -> Doubles
"""
this = _RMF_HDF5.new_Doubles(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def push_back(self, x):
"""push_back(Doubles self, std::vector< double >::value_type const & x)"""
return _RMF_HDF5.Doubles_push_back(self, x)
def front(self):
"""front(Doubles self) -> std::vector< double >::value_type const &"""
return _RMF_HDF5.Doubles_front(self)
def back(self):
"""back(Doubles self) -> std::vector< double >::value_type const &"""
return _RMF_HDF5.Doubles_back(self)
def assign(self, n, x):
"""assign(Doubles self, std::vector< double >::size_type n, std::vector< double >::value_type const & x)"""
return _RMF_HDF5.Doubles_assign(self, n, x)
def resize(self, *args):
"""
resize(Doubles self, std::vector< double >::size_type new_size)
resize(Doubles self, std::vector< double >::size_type new_size, std::vector< double >::value_type const & x)
"""
return _RMF_HDF5.Doubles_resize(self, *args)
def insert(self, *args):
"""
insert(Doubles self, std::vector< double >::iterator pos, std::vector< double >::value_type const & x) -> std::vector< double >::iterator
insert(Doubles self, std::vector< double >::iterator pos, std::vector< double >::size_type n, std::vector< double >::value_type const & x)
"""
return _RMF_HDF5.Doubles_insert(self, *args)
def reserve(self, n):
"""reserve(Doubles self, std::vector< double >::size_type n)"""
return _RMF_HDF5.Doubles_reserve(self, n)
def capacity(self):
"""capacity(Doubles self) -> std::vector< double >::size_type"""
return _RMF_HDF5.Doubles_capacity(self)
__swig_destroy__ = _RMF_HDF5.delete_Doubles
__del__ = lambda self: None
Doubles_swigregister = _RMF_HDF5.Doubles_swigregister
Doubles_swigregister(Doubles)
class IntsList(_object):
"""Proxy of C++ std::vector<(std::vector<(int)>)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, IntsList, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, IntsList, name)
__repr__ = _swig_repr
def iterator(self):
"""iterator(IntsList self) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.IntsList_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
"""__nonzero__(IntsList self) -> bool"""
return _RMF_HDF5.IntsList___nonzero__(self)
def __bool__(self):
"""__bool__(IntsList self) -> bool"""
return _RMF_HDF5.IntsList___bool__(self)
def __len__(self):
"""__len__(IntsList self) -> std::vector< std::vector< int > >::size_type"""
return _RMF_HDF5.IntsList___len__(self)
def __getslice__(self, i, j):
"""__getslice__(IntsList self, std::vector< std::vector< int > >::difference_type i, std::vector< std::vector< int > >::difference_type j) -> IntsList"""
return _RMF_HDF5.IntsList___getslice__(self, i, j)
def __setslice__(self, *args):
"""
__setslice__(IntsList self, std::vector< std::vector< int > >::difference_type i, std::vector< std::vector< int > >::difference_type j)
__setslice__(IntsList self, std::vector< std::vector< int > >::difference_type i, std::vector< std::vector< int > >::difference_type j, IntsList v)
"""
return _RMF_HDF5.IntsList___setslice__(self, *args)
def __delslice__(self, i, j):
"""__delslice__(IntsList self, std::vector< std::vector< int > >::difference_type i, std::vector< std::vector< int > >::difference_type j)"""
return _RMF_HDF5.IntsList___delslice__(self, i, j)
def __delitem__(self, *args):
"""
__delitem__(IntsList self, std::vector< std::vector< int > >::difference_type i)
__delitem__(IntsList self, PySliceObject * slice)
"""
return _RMF_HDF5.IntsList___delitem__(self, *args)
def __getitem__(self, *args):
"""
__getitem__(IntsList self, PySliceObject * slice) -> IntsList
__getitem__(IntsList self, std::vector< std::vector< int > >::difference_type i) -> Ints
"""
return _RMF_HDF5.IntsList___getitem__(self, *args)
def __setitem__(self, *args):
"""
__setitem__(IntsList self, PySliceObject * slice, IntsList v)
__setitem__(IntsList self, PySliceObject * slice)
__setitem__(IntsList self, std::vector< std::vector< int > >::difference_type i, Ints x)
"""
return _RMF_HDF5.IntsList___setitem__(self, *args)
def pop(self):
"""pop(IntsList self) -> Ints"""
return _RMF_HDF5.IntsList_pop(self)
def append(self, x):
"""append(IntsList self, Ints x)"""
return _RMF_HDF5.IntsList_append(self, x)
def empty(self):
"""empty(IntsList self) -> bool"""
return _RMF_HDF5.IntsList_empty(self)
def size(self):
"""size(IntsList self) -> std::vector< std::vector< int > >::size_type"""
return _RMF_HDF5.IntsList_size(self)
def swap(self, v):
"""swap(IntsList self, IntsList v)"""
return _RMF_HDF5.IntsList_swap(self, v)
def begin(self):
"""begin(IntsList self) -> std::vector< std::vector< int > >::iterator"""
return _RMF_HDF5.IntsList_begin(self)
def end(self):
"""end(IntsList self) -> std::vector< std::vector< int > >::iterator"""
return _RMF_HDF5.IntsList_end(self)
def rbegin(self):
"""rbegin(IntsList self) -> std::vector< std::vector< int > >::reverse_iterator"""
return _RMF_HDF5.IntsList_rbegin(self)
def rend(self):
"""rend(IntsList self) -> std::vector< std::vector< int > >::reverse_iterator"""
return _RMF_HDF5.IntsList_rend(self)
def clear(self):
"""clear(IntsList self)"""
return _RMF_HDF5.IntsList_clear(self)
def get_allocator(self):
"""get_allocator(IntsList self) -> std::vector< std::vector< int > >::allocator_type"""
return _RMF_HDF5.IntsList_get_allocator(self)
def pop_back(self):
"""pop_back(IntsList self)"""
return _RMF_HDF5.IntsList_pop_back(self)
def erase(self, *args):
"""
erase(IntsList self, std::vector< std::vector< int > >::iterator pos) -> std::vector< std::vector< int > >::iterator
erase(IntsList self, std::vector< std::vector< int > >::iterator first, std::vector< std::vector< int > >::iterator last) -> std::vector< std::vector< int > >::iterator
"""
return _RMF_HDF5.IntsList_erase(self, *args)
def __init__(self, *args):
"""
__init__(std::vector<(std::vector<(int)>)> self) -> IntsList
__init__(std::vector<(std::vector<(int)>)> self, IntsList arg2) -> IntsList
__init__(std::vector<(std::vector<(int)>)> self, std::vector< std::vector< int > >::size_type size) -> IntsList
__init__(std::vector<(std::vector<(int)>)> self, std::vector< std::vector< int > >::size_type size, Ints value) -> IntsList
"""
this = _RMF_HDF5.new_IntsList(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def push_back(self, x):
"""push_back(IntsList self, Ints x)"""
return _RMF_HDF5.IntsList_push_back(self, x)
def front(self):
"""front(IntsList self) -> Ints"""
return _RMF_HDF5.IntsList_front(self)
def back(self):
"""back(IntsList self) -> Ints"""
return _RMF_HDF5.IntsList_back(self)
def assign(self, n, x):
"""assign(IntsList self, std::vector< std::vector< int > >::size_type n, Ints x)"""
return _RMF_HDF5.IntsList_assign(self, n, x)
def resize(self, *args):
"""
resize(IntsList self, std::vector< std::vector< int > >::size_type new_size)
resize(IntsList self, std::vector< std::vector< int > >::size_type new_size, Ints x)
"""
return _RMF_HDF5.IntsList_resize(self, *args)
def insert(self, *args):
"""
insert(IntsList self, std::vector< std::vector< int > >::iterator pos, Ints x) -> std::vector< std::vector< int > >::iterator
insert(IntsList self, std::vector< std::vector< int > >::iterator pos, std::vector< std::vector< int > >::size_type n, Ints x)
"""
return _RMF_HDF5.IntsList_insert(self, *args)
def reserve(self, n):
"""reserve(IntsList self, std::vector< std::vector< int > >::size_type n)"""
return _RMF_HDF5.IntsList_reserve(self, n)
def capacity(self):
"""capacity(IntsList self) -> std::vector< std::vector< int > >::size_type"""
return _RMF_HDF5.IntsList_capacity(self)
__swig_destroy__ = _RMF_HDF5.delete_IntsList
__del__ = lambda self: None
IntsList_swigregister = _RMF_HDF5.IntsList_swigregister
IntsList_swigregister(IntsList)
class FloatsList(_object):
"""Proxy of C++ std::vector<(std::vector<(float)>)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatsList, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, FloatsList, name)
__repr__ = _swig_repr
def iterator(self):
"""iterator(FloatsList self) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.FloatsList_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
"""__nonzero__(FloatsList self) -> bool"""
return _RMF_HDF5.FloatsList___nonzero__(self)
def __bool__(self):
"""__bool__(FloatsList self) -> bool"""
return _RMF_HDF5.FloatsList___bool__(self)
def __len__(self):
"""__len__(FloatsList self) -> std::vector< std::vector< float > >::size_type"""
return _RMF_HDF5.FloatsList___len__(self)
def __getslice__(self, i, j):
"""__getslice__(FloatsList self, std::vector< std::vector< float > >::difference_type i, std::vector< std::vector< float > >::difference_type j) -> FloatsList"""
return _RMF_HDF5.FloatsList___getslice__(self, i, j)
def __setslice__(self, *args):
"""
__setslice__(FloatsList self, std::vector< std::vector< float > >::difference_type i, std::vector< std::vector< float > >::difference_type j)
__setslice__(FloatsList self, std::vector< std::vector< float > >::difference_type i, std::vector< std::vector< float > >::difference_type j, FloatsList v)
"""
return _RMF_HDF5.FloatsList___setslice__(self, *args)
def __delslice__(self, i, j):
"""__delslice__(FloatsList self, std::vector< std::vector< float > >::difference_type i, std::vector< std::vector< float > >::difference_type j)"""
return _RMF_HDF5.FloatsList___delslice__(self, i, j)
def __delitem__(self, *args):
"""
__delitem__(FloatsList self, std::vector< std::vector< float > >::difference_type i)
__delitem__(FloatsList self, PySliceObject * slice)
"""
return _RMF_HDF5.FloatsList___delitem__(self, *args)
def __getitem__(self, *args):
"""
__getitem__(FloatsList self, PySliceObject * slice) -> FloatsList
__getitem__(FloatsList self, std::vector< std::vector< float > >::difference_type i) -> Floats
"""
return _RMF_HDF5.FloatsList___getitem__(self, *args)
def __setitem__(self, *args):
"""
__setitem__(FloatsList self, PySliceObject * slice, FloatsList v)
__setitem__(FloatsList self, PySliceObject * slice)
__setitem__(FloatsList self, std::vector< std::vector< float > >::difference_type i, Floats x)
"""
return _RMF_HDF5.FloatsList___setitem__(self, *args)
def pop(self):
"""pop(FloatsList self) -> Floats"""
return _RMF_HDF5.FloatsList_pop(self)
def append(self, x):
"""append(FloatsList self, Floats x)"""
return _RMF_HDF5.FloatsList_append(self, x)
def empty(self):
"""empty(FloatsList self) -> bool"""
return _RMF_HDF5.FloatsList_empty(self)
def size(self):
"""size(FloatsList self) -> std::vector< std::vector< float > >::size_type"""
return _RMF_HDF5.FloatsList_size(self)
def swap(self, v):
"""swap(FloatsList self, FloatsList v)"""
return _RMF_HDF5.FloatsList_swap(self, v)
def begin(self):
"""begin(FloatsList self) -> std::vector< std::vector< float > >::iterator"""
return _RMF_HDF5.FloatsList_begin(self)
def end(self):
"""end(FloatsList self) -> std::vector< std::vector< float > >::iterator"""
return _RMF_HDF5.FloatsList_end(self)
def rbegin(self):
"""rbegin(FloatsList self) -> std::vector< std::vector< float > >::reverse_iterator"""
return _RMF_HDF5.FloatsList_rbegin(self)
def rend(self):
"""rend(FloatsList self) -> std::vector< std::vector< float > >::reverse_iterator"""
return _RMF_HDF5.FloatsList_rend(self)
def clear(self):
"""clear(FloatsList self)"""
return _RMF_HDF5.FloatsList_clear(self)
def get_allocator(self):
"""get_allocator(FloatsList self) -> std::vector< std::vector< float > >::allocator_type"""
return _RMF_HDF5.FloatsList_get_allocator(self)
def pop_back(self):
"""pop_back(FloatsList self)"""
return _RMF_HDF5.FloatsList_pop_back(self)
def erase(self, *args):
"""
erase(FloatsList self, std::vector< std::vector< float > >::iterator pos) -> std::vector< std::vector< float > >::iterator
erase(FloatsList self, std::vector< std::vector< float > >::iterator first, std::vector< std::vector< float > >::iterator last) -> std::vector< std::vector< float > >::iterator
"""
return _RMF_HDF5.FloatsList_erase(self, *args)
def __init__(self, *args):
"""
__init__(std::vector<(std::vector<(float)>)> self) -> FloatsList
__init__(std::vector<(std::vector<(float)>)> self, FloatsList arg2) -> FloatsList
__init__(std::vector<(std::vector<(float)>)> self, std::vector< std::vector< float > >::size_type size) -> FloatsList
__init__(std::vector<(std::vector<(float)>)> self, std::vector< std::vector< float > >::size_type size, Floats value) -> FloatsList
"""
this = _RMF_HDF5.new_FloatsList(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def push_back(self, x):
"""push_back(FloatsList self, Floats x)"""
return _RMF_HDF5.FloatsList_push_back(self, x)
def front(self):
"""front(FloatsList self) -> Floats"""
return _RMF_HDF5.FloatsList_front(self)
def back(self):
"""back(FloatsList self) -> Floats"""
return _RMF_HDF5.FloatsList_back(self)
def assign(self, n, x):
"""assign(FloatsList self, std::vector< std::vector< float > >::size_type n, Floats x)"""
return _RMF_HDF5.FloatsList_assign(self, n, x)
def resize(self, *args):
"""
resize(FloatsList self, std::vector< std::vector< float > >::size_type new_size)
resize(FloatsList self, std::vector< std::vector< float > >::size_type new_size, Floats x)
"""
return _RMF_HDF5.FloatsList_resize(self, *args)
def insert(self, *args):
"""
insert(FloatsList self, std::vector< std::vector< float > >::iterator pos, Floats x) -> std::vector< std::vector< float > >::iterator
insert(FloatsList self, std::vector< std::vector< float > >::iterator pos, std::vector< std::vector< float > >::size_type n, Floats x)
"""
return _RMF_HDF5.FloatsList_insert(self, *args)
def reserve(self, n):
"""reserve(FloatsList self, std::vector< std::vector< float > >::size_type n)"""
return _RMF_HDF5.FloatsList_reserve(self, n)
def capacity(self):
"""capacity(FloatsList self) -> std::vector< std::vector< float > >::size_type"""
return _RMF_HDF5.FloatsList_capacity(self)
__swig_destroy__ = _RMF_HDF5.delete_FloatsList
__del__ = lambda self: None
FloatsList_swigregister = _RMF_HDF5.FloatsList_swigregister
FloatsList_swigregister(FloatsList)
class StringsList(_object):
"""Proxy of C++ std::vector<(std::vector<(std::string)>)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, StringsList, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, StringsList, name)
__repr__ = _swig_repr
def iterator(self):
"""iterator(StringsList self) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.StringsList_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
"""__nonzero__(StringsList self) -> bool"""
return _RMF_HDF5.StringsList___nonzero__(self)
def __bool__(self):
"""__bool__(StringsList self) -> bool"""
return _RMF_HDF5.StringsList___bool__(self)
def __len__(self):
"""__len__(StringsList self) -> std::vector< std::vector< std::string > >::size_type"""
return _RMF_HDF5.StringsList___len__(self)
def __getslice__(self, i, j):
"""__getslice__(StringsList self, std::vector< std::vector< std::string > >::difference_type i, std::vector< std::vector< std::string > >::difference_type j) -> StringsList"""
return _RMF_HDF5.StringsList___getslice__(self, i, j)
def __setslice__(self, *args):
"""
__setslice__(StringsList self, std::vector< std::vector< std::string > >::difference_type i, std::vector< std::vector< std::string > >::difference_type j)
__setslice__(StringsList self, std::vector< std::vector< std::string > >::difference_type i, std::vector< std::vector< std::string > >::difference_type j, StringsList v)
"""
return _RMF_HDF5.StringsList___setslice__(self, *args)
def __delslice__(self, i, j):
"""__delslice__(StringsList self, std::vector< std::vector< std::string > >::difference_type i, std::vector< std::vector< std::string > >::difference_type j)"""
return _RMF_HDF5.StringsList___delslice__(self, i, j)
def __delitem__(self, *args):
"""
__delitem__(StringsList self, std::vector< std::vector< std::string > >::difference_type i)
__delitem__(StringsList self, PySliceObject * slice)
"""
return _RMF_HDF5.StringsList___delitem__(self, *args)
def __getitem__(self, *args):
"""
__getitem__(StringsList self, PySliceObject * slice) -> StringsList
__getitem__(StringsList self, std::vector< std::vector< std::string > >::difference_type i) -> Strings
"""
return _RMF_HDF5.StringsList___getitem__(self, *args)
def __setitem__(self, *args):
"""
__setitem__(StringsList self, PySliceObject * slice, StringsList v)
__setitem__(StringsList self, PySliceObject * slice)
__setitem__(StringsList self, std::vector< std::vector< std::string > >::difference_type i, Strings x)
"""
return _RMF_HDF5.StringsList___setitem__(self, *args)
def pop(self):
"""pop(StringsList self) -> Strings"""
return _RMF_HDF5.StringsList_pop(self)
def append(self, x):
"""append(StringsList self, Strings x)"""
return _RMF_HDF5.StringsList_append(self, x)
def empty(self):
"""empty(StringsList self) -> bool"""
return _RMF_HDF5.StringsList_empty(self)
def size(self):
"""size(StringsList self) -> std::vector< std::vector< std::string > >::size_type"""
return _RMF_HDF5.StringsList_size(self)
def swap(self, v):
"""swap(StringsList self, StringsList v)"""
return _RMF_HDF5.StringsList_swap(self, v)
def begin(self):
"""begin(StringsList self) -> std::vector< std::vector< std::string > >::iterator"""
return _RMF_HDF5.StringsList_begin(self)
def end(self):
"""end(StringsList self) -> std::vector< std::vector< std::string > >::iterator"""
return _RMF_HDF5.StringsList_end(self)
def rbegin(self):
"""rbegin(StringsList self) -> std::vector< std::vector< std::string > >::reverse_iterator"""
return _RMF_HDF5.StringsList_rbegin(self)
def rend(self):
"""rend(StringsList self) -> std::vector< std::vector< std::string > >::reverse_iterator"""
return _RMF_HDF5.StringsList_rend(self)
def clear(self):
"""clear(StringsList self)"""
return _RMF_HDF5.StringsList_clear(self)
def get_allocator(self):
"""get_allocator(StringsList self) -> std::vector< std::vector< std::string > >::allocator_type"""
return _RMF_HDF5.StringsList_get_allocator(self)
def pop_back(self):
"""pop_back(StringsList self)"""
return _RMF_HDF5.StringsList_pop_back(self)
def erase(self, *args):
"""
erase(StringsList self, std::vector< std::vector< std::string > >::iterator pos) -> std::vector< std::vector< std::string > >::iterator
erase(StringsList self, std::vector< std::vector< std::string > >::iterator first, std::vector< std::vector< std::string > >::iterator last) -> std::vector< std::vector< std::string > >::iterator
"""
return _RMF_HDF5.StringsList_erase(self, *args)
def __init__(self, *args):
"""
__init__(std::vector<(std::vector<(std::string)>)> self) -> StringsList
__init__(std::vector<(std::vector<(std::string)>)> self, StringsList arg2) -> StringsList
__init__(std::vector<(std::vector<(std::string)>)> self, std::vector< std::vector< std::string > >::size_type size) -> StringsList
__init__(std::vector<(std::vector<(std::string)>)> self, std::vector< std::vector< std::string > >::size_type size, Strings value) -> StringsList
"""
this = _RMF_HDF5.new_StringsList(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def push_back(self, x):
"""push_back(StringsList self, Strings x)"""
return _RMF_HDF5.StringsList_push_back(self, x)
def front(self):
"""front(StringsList self) -> Strings"""
return _RMF_HDF5.StringsList_front(self)
def back(self):
"""back(StringsList self) -> Strings"""
return _RMF_HDF5.StringsList_back(self)
def assign(self, n, x):
"""assign(StringsList self, std::vector< std::vector< std::string > >::size_type n, Strings x)"""
return _RMF_HDF5.StringsList_assign(self, n, x)
def resize(self, *args):
"""
resize(StringsList self, std::vector< std::vector< std::string > >::size_type new_size)
resize(StringsList self, std::vector< std::vector< std::string > >::size_type new_size, Strings x)
"""
return _RMF_HDF5.StringsList_resize(self, *args)
def insert(self, *args):
"""
insert(StringsList self, std::vector< std::vector< std::string > >::iterator pos, Strings x) -> std::vector< std::vector< std::string > >::iterator
insert(StringsList self, std::vector< std::vector< std::string > >::iterator pos, std::vector< std::vector< std::string > >::size_type n, Strings x)
"""
return _RMF_HDF5.StringsList_insert(self, *args)
def reserve(self, n):
"""reserve(StringsList self, std::vector< std::vector< std::string > >::size_type n)"""
return _RMF_HDF5.StringsList_reserve(self, n)
def capacity(self):
"""capacity(StringsList self) -> std::vector< std::vector< std::string > >::size_type"""
return _RMF_HDF5.StringsList_capacity(self)
__swig_destroy__ = _RMF_HDF5.delete_StringsList
__del__ = lambda self: None
StringsList_swigregister = _RMF_HDF5.StringsList_swigregister
StringsList_swigregister(StringsList)
class DoublesList(_object):
"""Proxy of C++ std::vector<(std::vector<(double)>)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, DoublesList, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, DoublesList, name)
__repr__ = _swig_repr
def iterator(self):
"""iterator(DoublesList self) -> RMF_HDF5_SwigPyIterator"""
return _RMF_HDF5.DoublesList_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
"""__nonzero__(DoublesList self) -> bool"""
return _RMF_HDF5.DoublesList___nonzero__(self)
def __bool__(self):
"""__bool__(DoublesList self) -> bool"""
return _RMF_HDF5.DoublesList___bool__(self)
def __len__(self):
"""__len__(DoublesList self) -> std::vector< std::vector< double > >::size_type"""
return _RMF_HDF5.DoublesList___len__(self)
def __getslice__(self, i, j):
"""__getslice__(DoublesList self, std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::difference_type j) -> DoublesList"""
return _RMF_HDF5.DoublesList___getslice__(self, i, j)
def __setslice__(self, *args):
"""
__setslice__(DoublesList self, std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::difference_type j)
__setslice__(DoublesList self, std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::difference_type j, DoublesList v)
"""
return _RMF_HDF5.DoublesList___setslice__(self, *args)
def __delslice__(self, i, j):
"""__delslice__(DoublesList self, std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::difference_type j)"""
return _RMF_HDF5.DoublesList___delslice__(self, i, j)
def __delitem__(self, *args):
"""
__delitem__(DoublesList self, std::vector< std::vector< double > >::difference_type i)
__delitem__(DoublesList self, PySliceObject * slice)
"""
return _RMF_HDF5.DoublesList___delitem__(self, *args)
def __getitem__(self, *args):
"""
__getitem__(DoublesList self, PySliceObject * slice) -> DoublesList
__getitem__(DoublesList self, std::vector< std::vector< double > >::difference_type i) -> Doubles
"""
return _RMF_HDF5.DoublesList___getitem__(self, *args)
def __setitem__(self, *args):
"""
__setitem__(DoublesList self, PySliceObject * slice, DoublesList v)
__setitem__(DoublesList self, PySliceObject * slice)
__setitem__(DoublesList self, std::vector< std::vector< double > >::difference_type i, Doubles x)
"""
return _RMF_HDF5.DoublesList___setitem__(self, *args)
def pop(self):
"""pop(DoublesList self) -> Doubles"""
return _RMF_HDF5.DoublesList_pop(self)
def append(self, x):
"""append(DoublesList self, Doubles x)"""
return _RMF_HDF5.DoublesList_append(self, x)
def empty(self):
"""empty(DoublesList self) -> bool"""
return _RMF_HDF5.DoublesList_empty(self)
def size(self):
"""size(DoublesList self) -> std::vector< std::vector< double > >::size_type"""
return _RMF_HDF5.DoublesList_size(self)
def swap(self, v):
"""swap(DoublesList self, DoublesList v)"""
return _RMF_HDF5.DoublesList_swap(self, v)
def begin(self):
"""begin(DoublesList self) -> std::vector< std::vector< double > >::iterator"""
return _RMF_HDF5.DoublesList_begin(self)
def end(self):
"""end(DoublesList self) -> std::vector< std::vector< double > >::iterator"""
return _RMF_HDF5.DoublesList_end(self)
def rbegin(self):
"""rbegin(DoublesList self) -> std::vector< std::vector< double > >::reverse_iterator"""
return _RMF_HDF5.DoublesList_rbegin(self)
def rend(self):
"""rend(DoublesList self) -> std::vector< std::vector< double > >::reverse_iterator"""
return _RMF_HDF5.DoublesList_rend(self)
def clear(self):
"""clear(DoublesList self)"""
return _RMF_HDF5.DoublesList_clear(self)
def get_allocator(self):
"""get_allocator(DoublesList self) -> std::vector< std::vector< double > >::allocator_type"""
return _RMF_HDF5.DoublesList_get_allocator(self)
def pop_back(self):
"""pop_back(DoublesList self)"""
return _RMF_HDF5.DoublesList_pop_back(self)
def erase(self, *args):
"""
erase(DoublesList self, std::vector< std::vector< double > >::iterator pos) -> std::vector< std::vector< double > >::iterator
erase(DoublesList self, std::vector< std::vector< double > >::iterator first, std::vector< std::vector< double > >::iterator last) -> std::vector< std::vector< double > >::iterator
"""
return _RMF_HDF5.DoublesList_erase(self, *args)
def __init__(self, *args):
"""
__init__(std::vector<(std::vector<(double)>)> self) -> DoublesList
__init__(std::vector<(std::vector<(double)>)> self, DoublesList arg2) -> DoublesList
__init__(std::vector<(std::vector<(double)>)> self, std::vector< std::vector< double > >::size_type size) -> DoublesList
__init__(std::vector<(std::vector<(double)>)> self, std::vector< std::vector< double > >::size_type size, Doubles value) -> DoublesList
"""
this = _RMF_HDF5.new_DoublesList(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def push_back(self, x):
"""push_back(DoublesList self, Doubles x)"""
return _RMF_HDF5.DoublesList_push_back(self, x)
def front(self):
"""front(DoublesList self) -> Doubles"""
return _RMF_HDF5.DoublesList_front(self)
def back(self):
"""back(DoublesList self) -> Doubles"""
return _RMF_HDF5.DoublesList_back(self)
def assign(self, n, x):
"""assign(DoublesList self, std::vector< std::vector< double > >::size_type n, Doubles x)"""
return _RMF_HDF5.DoublesList_assign(self, n, x)
def resize(self, *args):
"""
resize(DoublesList self, std::vector< std::vector< double > >::size_type new_size)
resize(DoublesList self, std::vector< std::vector< double > >::size_type new_size, Doubles x)
"""
return _RMF_HDF5.DoublesList_resize(self, *args)
def insert(self, *args):
"""
insert(DoublesList self, std::vector< std::vector< double > >::iterator pos, Doubles x) -> std::vector< std::vector< double > >::iterator
insert(DoublesList self, std::vector< std::vector< double > >::iterator pos, std::vector< std::vector< double > >::size_type n, Doubles x)
"""
return _RMF_HDF5.DoublesList_insert(self, *args)
def reserve(self, n):
"""reserve(DoublesList self, std::vector< std::vector< double > >::size_type n)"""
return _RMF_HDF5.DoublesList_reserve(self, n)
def capacity(self):
"""capacity(DoublesList self) -> std::vector< std::vector< double > >::size_type"""
return _RMF_HDF5.DoublesList_capacity(self)
__swig_destroy__ = _RMF_HDF5.delete_DoublesList
__del__ = lambda self: None
DoublesList_swigregister = _RMF_HDF5.DoublesList_swigregister
DoublesList_swigregister(DoublesList)
_types_list.append("int")
_types_list.append("ints")
_types_list.append("float")
_types_list.append("floats")
_types_list.append("index")
_types_list.append("indexes")
_types_list.append("string")
_types_list.append("strings")
class IntTraitsBase(_object):
"""Proxy of C++ RMF::HDF5::IntTraitsBase class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, IntTraitsBase, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, IntTraitsBase, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
BatchOperations = _RMF_HDF5.IntTraitsBase_BatchOperations
def get_index():
"""get_index() -> int"""
return _RMF_HDF5.IntTraitsBase_get_index()
get_index = staticmethod(get_index)
def get_null_value():
"""get_null_value() -> RMF::HDF5::IntTraitsBase::Type const &"""
return _RMF_HDF5.IntTraitsBase_get_null_value()
get_null_value = staticmethod(get_null_value)
def get_is_null_value(t):
"""get_is_null_value(RMF::HDF5::IntTraitsBase::Type t) -> bool"""
return _RMF_HDF5.IntTraitsBase_get_is_null_value(t)
get_is_null_value = staticmethod(get_is_null_value)
def get_hdf5_fill_type():
"""get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5.IntTraitsBase_get_hdf5_fill_type()
get_hdf5_fill_type = staticmethod(get_hdf5_fill_type)
def get_hdf5_disk_type():
"""get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5.IntTraitsBase_get_hdf5_disk_type()
get_hdf5_disk_type = staticmethod(get_hdf5_disk_type)
def get_hdf5_memory_type():
"""get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5.IntTraitsBase_get_hdf5_memory_type()
get_hdf5_memory_type = staticmethod(get_hdf5_memory_type)
def get_fill_value():
"""get_fill_value() -> RMF::HDF5::IntTraitsBase::Type const &"""
return _RMF_HDF5.IntTraitsBase_get_fill_value()
get_fill_value = staticmethod(get_fill_value)
def get_name():
"""get_name() -> std::string"""
return _RMF_HDF5.IntTraitsBase_get_name()
get_name = staticmethod(get_name)
__swig_destroy__ = _RMF_HDF5.delete_IntTraitsBase
__del__ = lambda self: None
IntTraitsBase_swigregister = _RMF_HDF5.IntTraitsBase_swigregister
IntTraitsBase_swigregister(IntTraitsBase)
cvar = _RMF_HDF5.cvar
NullInt = cvar.NullInt
NullInts = cvar.NullInts
NullFloat = cvar.NullFloat
NullFloats = cvar.NullFloats
NullIndex = cvar.NullIndex
NullIndexes = cvar.NullIndexes
NullString = cvar.NullString
NullStrings = cvar.NullStrings
def IntTraitsBase_get_index():
"""IntTraitsBase_get_index() -> int"""
return _RMF_HDF5.IntTraitsBase_get_index()
def IntTraitsBase_get_null_value():
"""IntTraitsBase_get_null_value() -> RMF::HDF5::IntTraitsBase::Type const &"""
return _RMF_HDF5.IntTraitsBase_get_null_value()
def IntTraitsBase_get_is_null_value(t):
"""IntTraitsBase_get_is_null_value(RMF::HDF5::IntTraitsBase::Type t) -> bool"""
return _RMF_HDF5.IntTraitsBase_get_is_null_value(t)
def IntTraitsBase_get_hdf5_fill_type():
"""IntTraitsBase_get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5.IntTraitsBase_get_hdf5_fill_type()
def IntTraitsBase_get_hdf5_disk_type():
"""IntTraitsBase_get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5.IntTraitsBase_get_hdf5_disk_type()
def IntTraitsBase_get_hdf5_memory_type():
"""IntTraitsBase_get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5.IntTraitsBase_get_hdf5_memory_type()
def IntTraitsBase_get_fill_value():
"""IntTraitsBase_get_fill_value() -> RMF::HDF5::IntTraitsBase::Type const &"""
return _RMF_HDF5.IntTraitsBase_get_fill_value()
def IntTraitsBase_get_name():
"""IntTraitsBase_get_name() -> std::string"""
return _RMF_HDF5.IntTraitsBase_get_name()
def _IntTraitsBase():
"""_IntTraitsBase() -> IntTraitsBase"""
val = _RMF_HDF5.new__IntTraitsBase()
return val
class FloatTraitsBase(_object):
"""Proxy of C++ RMF::HDF5::FloatTraitsBase class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatTraitsBase, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, FloatTraitsBase, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
BatchOperations = _RMF_HDF5.FloatTraitsBase_BatchOperations
def get_index():
"""get_index() -> int"""
return _RMF_HDF5.FloatTraitsBase_get_index()
get_index = staticmethod(get_index)
def get_null_value():
"""get_null_value() -> RMF::HDF5::FloatTraitsBase::Type const &"""
return _RMF_HDF5.FloatTraitsBase_get_null_value()
get_null_value = staticmethod(get_null_value)
def get_is_null_value(t):
"""get_is_null_value(RMF::HDF5::FloatTraitsBase::Type t) -> bool"""
return _RMF_HDF5.FloatTraitsBase_get_is_null_value(t)
get_is_null_value = staticmethod(get_is_null_value)
def get_hdf5_fill_type():
"""get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5.FloatTraitsBase_get_hdf5_fill_type()
get_hdf5_fill_type = staticmethod(get_hdf5_fill_type)
def get_hdf5_disk_type():
"""get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5.FloatTraitsBase_get_hdf5_disk_type()
get_hdf5_disk_type = staticmethod(get_hdf5_disk_type)
def get_hdf5_memory_type():
"""get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5.FloatTraitsBase_get_hdf5_memory_type()
get_hdf5_memory_type = staticmethod(get_hdf5_memory_type)
def get_fill_value():
"""get_fill_value() -> RMF::HDF5::FloatTraitsBase::Type const &"""
return _RMF_HDF5.FloatTraitsBase_get_fill_value()
get_fill_value = staticmethod(get_fill_value)
def get_name():
"""get_name() -> std::string"""
return _RMF_HDF5.FloatTraitsBase_get_name()
get_name = staticmethod(get_name)
__swig_destroy__ = _RMF_HDF5.delete_FloatTraitsBase
__del__ = lambda self: None
FloatTraitsBase_swigregister = _RMF_HDF5.FloatTraitsBase_swigregister
FloatTraitsBase_swigregister(FloatTraitsBase)
def FloatTraitsBase_get_index():
"""FloatTraitsBase_get_index() -> int"""
return _RMF_HDF5.FloatTraitsBase_get_index()
def FloatTraitsBase_get_null_value():
"""FloatTraitsBase_get_null_value() -> RMF::HDF5::FloatTraitsBase::Type const &"""
return _RMF_HDF5.FloatTraitsBase_get_null_value()
def FloatTraitsBase_get_is_null_value(t):
"""FloatTraitsBase_get_is_null_value(RMF::HDF5::FloatTraitsBase::Type t) -> bool"""
return _RMF_HDF5.FloatTraitsBase_get_is_null_value(t)
def FloatTraitsBase_get_hdf5_fill_type():
"""FloatTraitsBase_get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5.FloatTraitsBase_get_hdf5_fill_type()
def FloatTraitsBase_get_hdf5_disk_type():
"""FloatTraitsBase_get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5.FloatTraitsBase_get_hdf5_disk_type()
def FloatTraitsBase_get_hdf5_memory_type():
"""FloatTraitsBase_get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5.FloatTraitsBase_get_hdf5_memory_type()
def FloatTraitsBase_get_fill_value():
"""FloatTraitsBase_get_fill_value() -> RMF::HDF5::FloatTraitsBase::Type const &"""
return _RMF_HDF5.FloatTraitsBase_get_fill_value()
def FloatTraitsBase_get_name():
"""FloatTraitsBase_get_name() -> std::string"""
return _RMF_HDF5.FloatTraitsBase_get_name()
def _FloatTraitsBase():
"""_FloatTraitsBase() -> FloatTraitsBase"""
val = _RMF_HDF5.new__FloatTraitsBase()
return val
class IndexTraitsBase(IntTraitsBase):
"""Proxy of C++ RMF::HDF5::IndexTraitsBase class."""
__swig_setmethods__ = {}
for _s in [IntTraitsBase]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexTraitsBase, name, value)
__swig_getmethods__ = {}
for _s in [IntTraitsBase]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexTraitsBase, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def get_index():
"""get_index() -> int"""
return _RMF_HDF5.IndexTraitsBase_get_index()
get_index = staticmethod(get_index)
def get_null_value():
"""get_null_value() -> RMF::HDF5::IntTraitsBase::Type const &"""
return _RMF_HDF5.IndexTraitsBase_get_null_value()
get_null_value = staticmethod(get_null_value)
def get_is_null_value(t):
"""get_is_null_value(RMF::HDF5::IntTraitsBase::Type t) -> bool"""
return _RMF_HDF5.IndexTraitsBase_get_is_null_value(t)
get_is_null_value = staticmethod(get_is_null_value)
def get_fill_value():
"""get_fill_value() -> RMF::HDF5::IntTraitsBase::Type const &"""
return _RMF_HDF5.IndexTraitsBase_get_fill_value()
get_fill_value = staticmethod(get_fill_value)
def get_name():
"""get_name() -> std::string"""
return _RMF_HDF5.IndexTraitsBase_get_name()
get_name = staticmethod(get_name)
__swig_destroy__ = _RMF_HDF5.delete_IndexTraitsBase
__del__ = lambda self: None
IndexTraitsBase_swigregister = _RMF_HDF5.IndexTraitsBase_swigregister
IndexTraitsBase_swigregister(IndexTraitsBase)
def IndexTraitsBase_get_index():
"""IndexTraitsBase_get_index() -> int"""
return _RMF_HDF5.IndexTraitsBase_get_index()
def IndexTraitsBase_get_null_value():
"""IndexTraitsBase_get_null_value() -> RMF::HDF5::IntTraitsBase::Type const &"""
return _RMF_HDF5.IndexTraitsBase_get_null_value()
def IndexTraitsBase_get_is_null_value(t):
"""IndexTraitsBase_get_is_null_value(RMF::HDF5::IntTraitsBase::Type t) -> bool"""
return _RMF_HDF5.IndexTraitsBase_get_is_null_value(t)
def IndexTraitsBase_get_fill_value():
"""IndexTraitsBase_get_fill_value() -> RMF::HDF5::IntTraitsBase::Type const &"""
return _RMF_HDF5.IndexTraitsBase_get_fill_value()
def IndexTraitsBase_get_name():
"""IndexTraitsBase_get_name() -> std::string"""
return _RMF_HDF5.IndexTraitsBase_get_name()
def _IndexTraitsBase():
"""_IndexTraitsBase() -> IndexTraitsBase"""
val = _RMF_HDF5.new__IndexTraitsBase()
return val
class _CharTraits(_object):
"""Proxy of C++ RMF::HDF5::CharTraits class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, _CharTraits, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, _CharTraits, name)
__repr__ = _swig_repr
BatchOperations = _RMF_HDF5._CharTraits_BatchOperations
def get_index():
"""get_index() -> int"""
return _RMF_HDF5._CharTraits_get_index()
get_index = staticmethod(get_index)
def get_null_value():
"""get_null_value() -> RMF::HDF5::CharTraits::Type const &"""
return _RMF_HDF5._CharTraits_get_null_value()
get_null_value = staticmethod(get_null_value)
def get_is_null_value(t):
"""get_is_null_value(RMF::HDF5::CharTraits::Type t) -> bool"""
return _RMF_HDF5._CharTraits_get_is_null_value(t)
get_is_null_value = staticmethod(get_is_null_value)
def get_hdf5_fill_type():
"""get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._CharTraits_get_hdf5_fill_type()
get_hdf5_fill_type = staticmethod(get_hdf5_fill_type)
def get_hdf5_disk_type():
"""get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._CharTraits_get_hdf5_disk_type()
get_hdf5_disk_type = staticmethod(get_hdf5_disk_type)
def get_hdf5_memory_type():
"""get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._CharTraits_get_hdf5_memory_type()
get_hdf5_memory_type = staticmethod(get_hdf5_memory_type)
def get_fill_value():
"""get_fill_value() -> RMF::HDF5::CharTraits::Type const &"""
return _RMF_HDF5._CharTraits_get_fill_value()
get_fill_value = staticmethod(get_fill_value)
def get_name():
"""get_name() -> std::string"""
return _RMF_HDF5._CharTraits_get_name()
get_name = staticmethod(get_name)
def write_value_dataset(arg1, arg2, arg3, arg4):
"""write_value_dataset(hid_t arg1, hid_t arg2, hid_t arg3, char arg4)"""
return _RMF_HDF5._CharTraits_write_value_dataset(arg1, arg2, arg3, arg4)
write_value_dataset = staticmethod(write_value_dataset)
def read_value_dataset(arg1, arg2, arg3):
"""read_value_dataset(hid_t arg1, hid_t arg2, hid_t arg3) -> char"""
return _RMF_HDF5._CharTraits_read_value_dataset(arg1, arg2, arg3)
read_value_dataset = staticmethod(read_value_dataset)
def write_values_dataset(arg1, arg2, arg3, arg4):
"""write_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, RMF::HDF5::CharTraits::Types const & arg4)"""
return _RMF_HDF5._CharTraits_write_values_dataset(arg1, arg2, arg3, arg4)
write_values_dataset = staticmethod(write_values_dataset)
def read_values_dataset(arg1, arg2, arg3, arg4):
"""read_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, unsigned int arg4) -> RMF::HDF5::CharTraits::Types"""
return _RMF_HDF5._CharTraits_read_values_dataset(arg1, arg2, arg3, arg4)
read_values_dataset = staticmethod(read_values_dataset)
def write_values_attribute(a, v):
"""write_values_attribute(hid_t a, RMF::HDF5::CharTraits::Types const & v)"""
return _RMF_HDF5._CharTraits_write_values_attribute(a, v)
write_values_attribute = staticmethod(write_values_attribute)
def read_values_attribute(a, sz):
"""read_values_attribute(hid_t a, unsigned int sz) -> RMF::HDF5::CharTraits::Types"""
return _RMF_HDF5._CharTraits_read_values_attribute(a, sz)
read_values_attribute = staticmethod(read_values_attribute)
def __init__(self):
"""__init__(RMF::HDF5::CharTraits self) -> _CharTraits"""
this = _RMF_HDF5.new__CharTraits()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__CharTraits
__del__ = lambda self: None
_CharTraits_swigregister = _RMF_HDF5._CharTraits_swigregister
_CharTraits_swigregister(_CharTraits)
def _CharTraits_get_index():
"""_CharTraits_get_index() -> int"""
return _RMF_HDF5._CharTraits_get_index()
def _CharTraits_get_null_value():
"""_CharTraits_get_null_value() -> RMF::HDF5::CharTraits::Type const &"""
return _RMF_HDF5._CharTraits_get_null_value()
def _CharTraits_get_is_null_value(t):
"""_CharTraits_get_is_null_value(RMF::HDF5::CharTraits::Type t) -> bool"""
return _RMF_HDF5._CharTraits_get_is_null_value(t)
def _CharTraits_get_hdf5_fill_type():
"""_CharTraits_get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._CharTraits_get_hdf5_fill_type()
def _CharTraits_get_hdf5_disk_type():
"""_CharTraits_get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._CharTraits_get_hdf5_disk_type()
def _CharTraits_get_hdf5_memory_type():
"""_CharTraits_get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._CharTraits_get_hdf5_memory_type()
def _CharTraits_get_fill_value():
"""_CharTraits_get_fill_value() -> RMF::HDF5::CharTraits::Type const &"""
return _RMF_HDF5._CharTraits_get_fill_value()
def _CharTraits_get_name():
"""_CharTraits_get_name() -> std::string"""
return _RMF_HDF5._CharTraits_get_name()
def _CharTraits_write_value_dataset(arg2, arg3, arg4, arg5):
"""_CharTraits_write_value_dataset(hid_t arg2, hid_t arg3, hid_t arg4, char arg5)"""
return _RMF_HDF5._CharTraits_write_value_dataset(arg2, arg3, arg4, arg5)
def _CharTraits_read_value_dataset(arg2, arg3, arg4):
"""_CharTraits_read_value_dataset(hid_t arg2, hid_t arg3, hid_t arg4) -> char"""
return _RMF_HDF5._CharTraits_read_value_dataset(arg2, arg3, arg4)
def _CharTraits_write_values_dataset(arg2, arg3, arg4, arg5):
"""_CharTraits_write_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, RMF::HDF5::CharTraits::Types const & arg5)"""
return _RMF_HDF5._CharTraits_write_values_dataset(arg2, arg3, arg4, arg5)
def _CharTraits_read_values_dataset(arg2, arg3, arg4, arg5):
"""_CharTraits_read_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, unsigned int arg5) -> RMF::HDF5::CharTraits::Types"""
return _RMF_HDF5._CharTraits_read_values_dataset(arg2, arg3, arg4, arg5)
def _CharTraits_write_values_attribute(a, v):
"""_CharTraits_write_values_attribute(hid_t a, RMF::HDF5::CharTraits::Types const & v)"""
return _RMF_HDF5._CharTraits_write_values_attribute(a, v)
def _CharTraits_read_values_attribute(a, sz):
"""_CharTraits_read_values_attribute(hid_t a, unsigned int sz) -> RMF::HDF5::CharTraits::Types"""
return _RMF_HDF5._CharTraits_read_values_attribute(a, sz)
class _StringTraits(_object):
"""Proxy of C++ RMF::HDF5::StringTraits class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, _StringTraits, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, _StringTraits, name)
__repr__ = _swig_repr
BatchOperations = _RMF_HDF5._StringTraits_BatchOperations
def get_index():
"""get_index() -> int"""
return _RMF_HDF5._StringTraits_get_index()
get_index = staticmethod(get_index)
def get_null_value():
"""get_null_value() -> RMF::HDF5::StringTraits::Type const &"""
return _RMF_HDF5._StringTraits_get_null_value()
get_null_value = staticmethod(get_null_value)
def get_is_null_value(t):
"""get_is_null_value(RMF::HDF5::StringTraits::Type t) -> bool"""
return _RMF_HDF5._StringTraits_get_is_null_value(t)
get_is_null_value = staticmethod(get_is_null_value)
def get_hdf5_fill_type():
"""get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._StringTraits_get_hdf5_fill_type()
get_hdf5_fill_type = staticmethod(get_hdf5_fill_type)
def get_hdf5_disk_type():
"""get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._StringTraits_get_hdf5_disk_type()
get_hdf5_disk_type = staticmethod(get_hdf5_disk_type)
def get_hdf5_memory_type():
"""get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._StringTraits_get_hdf5_memory_type()
get_hdf5_memory_type = staticmethod(get_hdf5_memory_type)
def get_fill_value():
"""get_fill_value() -> RMF::HDF5::StringTraits::Type const &"""
return _RMF_HDF5._StringTraits_get_fill_value()
get_fill_value = staticmethod(get_fill_value)
def get_name():
"""get_name() -> std::string"""
return _RMF_HDF5._StringTraits_get_name()
get_name = staticmethod(get_name)
def write_value_dataset(d, iss, s, v):
"""write_value_dataset(hid_t d, hid_t iss, hid_t s, RMF::HDF5::StringTraits::Type const & v)"""
return _RMF_HDF5._StringTraits_write_value_dataset(d, iss, s, v)
write_value_dataset = staticmethod(write_value_dataset)
def read_value_dataset(d, iss, sp):
"""read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> RMF::HDF5::StringTraits::Type"""
return _RMF_HDF5._StringTraits_read_value_dataset(d, iss, sp)
read_value_dataset = staticmethod(read_value_dataset)
def write_values_dataset(arg1, arg2, arg3, arg4):
"""write_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, Strings arg4)"""
return _RMF_HDF5._StringTraits_write_values_dataset(arg1, arg2, arg3, arg4)
write_values_dataset = staticmethod(write_values_dataset)
def read_values_dataset(arg1, arg2, arg3, arg4):
"""read_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, unsigned int arg4) -> Strings"""
return _RMF_HDF5._StringTraits_read_values_dataset(arg1, arg2, arg3, arg4)
read_values_dataset = staticmethod(read_values_dataset)
def read_values_attribute(arg1, arg2):
"""read_values_attribute(hid_t arg1, unsigned int arg2) -> Strings"""
return _RMF_HDF5._StringTraits_read_values_attribute(arg1, arg2)
read_values_attribute = staticmethod(read_values_attribute)
def write_values_attribute(arg1, arg2):
"""write_values_attribute(hid_t arg1, Strings arg2)"""
return _RMF_HDF5._StringTraits_write_values_attribute(arg1, arg2)
write_values_attribute = staticmethod(write_values_attribute)
def __init__(self):
"""__init__(RMF::HDF5::StringTraits self) -> _StringTraits"""
this = _RMF_HDF5.new__StringTraits()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__StringTraits
__del__ = lambda self: None
_StringTraits_swigregister = _RMF_HDF5._StringTraits_swigregister
_StringTraits_swigregister(_StringTraits)
def _StringTraits_get_index():
"""_StringTraits_get_index() -> int"""
return _RMF_HDF5._StringTraits_get_index()
def _StringTraits_get_null_value():
"""_StringTraits_get_null_value() -> RMF::HDF5::StringTraits::Type const &"""
return _RMF_HDF5._StringTraits_get_null_value()
def _StringTraits_get_is_null_value(t):
"""_StringTraits_get_is_null_value(RMF::HDF5::StringTraits::Type t) -> bool"""
return _RMF_HDF5._StringTraits_get_is_null_value(t)
def _StringTraits_get_hdf5_fill_type():
"""_StringTraits_get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._StringTraits_get_hdf5_fill_type()
def _StringTraits_get_hdf5_disk_type():
"""_StringTraits_get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._StringTraits_get_hdf5_disk_type()
def _StringTraits_get_hdf5_memory_type():
"""_StringTraits_get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._StringTraits_get_hdf5_memory_type()
def _StringTraits_get_fill_value():
"""_StringTraits_get_fill_value() -> RMF::HDF5::StringTraits::Type const &"""
return _RMF_HDF5._StringTraits_get_fill_value()
def _StringTraits_get_name():
"""_StringTraits_get_name() -> std::string"""
return _RMF_HDF5._StringTraits_get_name()
def _StringTraits_write_value_dataset(d, iss, s, v):
"""_StringTraits_write_value_dataset(hid_t d, hid_t iss, hid_t s, RMF::HDF5::StringTraits::Type const & v)"""
return _RMF_HDF5._StringTraits_write_value_dataset(d, iss, s, v)
def _StringTraits_read_value_dataset(d, iss, sp):
"""_StringTraits_read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> RMF::HDF5::StringTraits::Type"""
return _RMF_HDF5._StringTraits_read_value_dataset(d, iss, sp)
def _StringTraits_write_values_dataset(arg2, arg3, arg4, arg5):
"""_StringTraits_write_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, Strings arg5)"""
return _RMF_HDF5._StringTraits_write_values_dataset(arg2, arg3, arg4, arg5)
def _StringTraits_read_values_dataset(arg2, arg3, arg4, arg5):
"""_StringTraits_read_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, unsigned int arg5) -> Strings"""
return _RMF_HDF5._StringTraits_read_values_dataset(arg2, arg3, arg4, arg5)
def _StringTraits_read_values_attribute(arg2, arg3):
"""_StringTraits_read_values_attribute(hid_t arg2, unsigned int arg3) -> Strings"""
return _RMF_HDF5._StringTraits_read_values_attribute(arg2, arg3)
def _StringTraits_write_values_attribute(arg2, arg3):
"""_StringTraits_write_values_attribute(hid_t arg2, Strings arg3)"""
return _RMF_HDF5._StringTraits_write_values_attribute(arg2, arg3)
class _StringsTraits(_object):
"""Proxy of C++ RMF::HDF5::StringsTraits class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, _StringsTraits, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, _StringsTraits, name)
__repr__ = _swig_repr
BatchOperations = _RMF_HDF5._StringsTraits_BatchOperations
def get_index():
"""get_index() -> int"""
return _RMF_HDF5._StringsTraits_get_index()
get_index = staticmethod(get_index)
def get_null_value():
"""get_null_value() -> Strings"""
return _RMF_HDF5._StringsTraits_get_null_value()
get_null_value = staticmethod(get_null_value)
def get_is_null_value(t):
"""get_is_null_value(Strings t) -> bool"""
return _RMF_HDF5._StringsTraits_get_is_null_value(t)
get_is_null_value = staticmethod(get_is_null_value)
def get_hdf5_fill_type():
"""get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._StringsTraits_get_hdf5_fill_type()
get_hdf5_fill_type = staticmethod(get_hdf5_fill_type)
def get_hdf5_disk_type():
"""get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._StringsTraits_get_hdf5_disk_type()
get_hdf5_disk_type = staticmethod(get_hdf5_disk_type)
def get_hdf5_memory_type():
"""get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._StringsTraits_get_hdf5_memory_type()
get_hdf5_memory_type = staticmethod(get_hdf5_memory_type)
def get_fill_value():
"""get_fill_value() -> hvl_t const &"""
return _RMF_HDF5._StringsTraits_get_fill_value()
get_fill_value = staticmethod(get_fill_value)
def get_name():
"""get_name() -> std::string"""
return _RMF_HDF5._StringsTraits_get_name()
get_name = staticmethod(get_name)
def write_value_dataset(d, iss, s, v):
"""write_value_dataset(hid_t d, hid_t iss, hid_t s, Strings v)"""
return _RMF_HDF5._StringsTraits_write_value_dataset(d, iss, s, v)
write_value_dataset = staticmethod(write_value_dataset)
def read_value_dataset(d, iss, sp):
"""read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> Strings"""
return _RMF_HDF5._StringsTraits_read_value_dataset(d, iss, sp)
read_value_dataset = staticmethod(read_value_dataset)
def write_values_dataset(arg1, arg2, arg3, arg4):
"""write_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, StringsList arg4)"""
return _RMF_HDF5._StringsTraits_write_values_dataset(arg1, arg2, arg3, arg4)
write_values_dataset = staticmethod(write_values_dataset)
def read_values_dataset(arg1, arg2, arg3, arg4):
"""read_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, unsigned int arg4) -> StringsList"""
return _RMF_HDF5._StringsTraits_read_values_dataset(arg1, arg2, arg3, arg4)
read_values_dataset = staticmethod(read_values_dataset)
def read_values_attribute(arg1, arg2):
"""read_values_attribute(hid_t arg1, unsigned int arg2) -> StringsList"""
return _RMF_HDF5._StringsTraits_read_values_attribute(arg1, arg2)
read_values_attribute = staticmethod(read_values_attribute)
def write_values_attribute(arg1, arg2):
"""write_values_attribute(hid_t arg1, StringsList arg2)"""
return _RMF_HDF5._StringsTraits_write_values_attribute(arg1, arg2)
write_values_attribute = staticmethod(write_values_attribute)
def __init__(self):
"""__init__(RMF::HDF5::StringsTraits self) -> _StringsTraits"""
this = _RMF_HDF5.new__StringsTraits()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__StringsTraits
__del__ = lambda self: None
_StringsTraits_swigregister = _RMF_HDF5._StringsTraits_swigregister
_StringsTraits_swigregister(_StringsTraits)
def _StringsTraits_get_index():
"""_StringsTraits_get_index() -> int"""
return _RMF_HDF5._StringsTraits_get_index()
def _StringsTraits_get_null_value():
"""_StringsTraits_get_null_value() -> Strings"""
return _RMF_HDF5._StringsTraits_get_null_value()
def _StringsTraits_get_is_null_value(t):
"""_StringsTraits_get_is_null_value(Strings t) -> bool"""
return _RMF_HDF5._StringsTraits_get_is_null_value(t)
def _StringsTraits_get_hdf5_fill_type():
"""_StringsTraits_get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._StringsTraits_get_hdf5_fill_type()
def _StringsTraits_get_hdf5_disk_type():
"""_StringsTraits_get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._StringsTraits_get_hdf5_disk_type()
def _StringsTraits_get_hdf5_memory_type():
"""_StringsTraits_get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._StringsTraits_get_hdf5_memory_type()
def _StringsTraits_get_fill_value():
"""_StringsTraits_get_fill_value() -> hvl_t const &"""
return _RMF_HDF5._StringsTraits_get_fill_value()
def _StringsTraits_get_name():
"""_StringsTraits_get_name() -> std::string"""
return _RMF_HDF5._StringsTraits_get_name()
def _StringsTraits_write_value_dataset(d, iss, s, v):
"""_StringsTraits_write_value_dataset(hid_t d, hid_t iss, hid_t s, Strings v)"""
return _RMF_HDF5._StringsTraits_write_value_dataset(d, iss, s, v)
def _StringsTraits_read_value_dataset(d, iss, sp):
"""_StringsTraits_read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> Strings"""
return _RMF_HDF5._StringsTraits_read_value_dataset(d, iss, sp)
def _StringsTraits_write_values_dataset(arg2, arg3, arg4, arg5):
"""_StringsTraits_write_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, StringsList arg5)"""
return _RMF_HDF5._StringsTraits_write_values_dataset(arg2, arg3, arg4, arg5)
def _StringsTraits_read_values_dataset(arg2, arg3, arg4, arg5):
"""_StringsTraits_read_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, unsigned int arg5) -> StringsList"""
return _RMF_HDF5._StringsTraits_read_values_dataset(arg2, arg3, arg4, arg5)
def _StringsTraits_read_values_attribute(arg2, arg3):
"""_StringsTraits_read_values_attribute(hid_t arg2, unsigned int arg3) -> StringsList"""
return _RMF_HDF5._StringsTraits_read_values_attribute(arg2, arg3)
def _StringsTraits_write_values_attribute(arg2, arg3):
"""_StringsTraits_write_values_attribute(hid_t arg2, StringsList arg3)"""
return _RMF_HDF5._StringsTraits_write_values_attribute(arg2, arg3)
class _IntTraitsBaseClass(IntTraitsBase):
"""Proxy of C++ RMF::HDF5::SimpleTraits<(RMF::HDF5::IntTraitsBase)> class."""
__swig_setmethods__ = {}
for _s in [IntTraitsBase]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _IntTraitsBaseClass, name, value)
__swig_getmethods__ = {}
for _s in [IntTraitsBase]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _IntTraitsBaseClass, name)
__repr__ = _swig_repr
def write_value_dataset(d, iss, s, v):
"""write_value_dataset(hid_t d, hid_t iss, hid_t s, RMF::HDF5::IntTraitsBase::Type v)"""
return _RMF_HDF5._IntTraitsBaseClass_write_value_dataset(d, iss, s, v)
write_value_dataset = staticmethod(write_value_dataset)
def read_value_dataset(d, iss, sp):
"""read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> RMF::HDF5::IntTraitsBase::Type"""
return _RMF_HDF5._IntTraitsBaseClass_read_value_dataset(d, iss, sp)
read_value_dataset = staticmethod(read_value_dataset)
def write_values_dataset(d, iss, s, v):
"""write_values_dataset(hid_t d, hid_t iss, hid_t s, Ints v)"""
return _RMF_HDF5._IntTraitsBaseClass_write_values_dataset(d, iss, s, v)
write_values_dataset = staticmethod(write_values_dataset)
def read_values_dataset(d, iss, sp, sz):
"""read_values_dataset(hid_t d, hid_t iss, hid_t sp, unsigned int sz) -> Ints"""
return _RMF_HDF5._IntTraitsBaseClass_read_values_dataset(d, iss, sp, sz)
read_values_dataset = staticmethod(read_values_dataset)
def write_values_attribute(a, v):
"""write_values_attribute(hid_t a, Ints v)"""
return _RMF_HDF5._IntTraitsBaseClass_write_values_attribute(a, v)
write_values_attribute = staticmethod(write_values_attribute)
def read_values_attribute(a, sz):
"""read_values_attribute(hid_t a, unsigned int sz) -> Ints"""
return _RMF_HDF5._IntTraitsBaseClass_read_values_attribute(a, sz)
read_values_attribute = staticmethod(read_values_attribute)
def __init__(self):
"""__init__(RMF::HDF5::SimpleTraits<(RMF::HDF5::IntTraitsBase)> self) -> _IntTraitsBaseClass"""
this = _RMF_HDF5.new__IntTraitsBaseClass()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__IntTraitsBaseClass
__del__ = lambda self: None
_IntTraitsBaseClass_swigregister = _RMF_HDF5._IntTraitsBaseClass_swigregister
_IntTraitsBaseClass_swigregister(_IntTraitsBaseClass)
def _IntTraitsBaseClass_write_value_dataset(d, iss, s, v):
"""_IntTraitsBaseClass_write_value_dataset(hid_t d, hid_t iss, hid_t s, RMF::HDF5::IntTraitsBase::Type v)"""
return _RMF_HDF5._IntTraitsBaseClass_write_value_dataset(d, iss, s, v)
def _IntTraitsBaseClass_read_value_dataset(d, iss, sp):
"""_IntTraitsBaseClass_read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> RMF::HDF5::IntTraitsBase::Type"""
return _RMF_HDF5._IntTraitsBaseClass_read_value_dataset(d, iss, sp)
def _IntTraitsBaseClass_write_values_dataset(d, iss, s, v):
"""_IntTraitsBaseClass_write_values_dataset(hid_t d, hid_t iss, hid_t s, Ints v)"""
return _RMF_HDF5._IntTraitsBaseClass_write_values_dataset(d, iss, s, v)
def _IntTraitsBaseClass_read_values_dataset(d, iss, sp, sz):
"""_IntTraitsBaseClass_read_values_dataset(hid_t d, hid_t iss, hid_t sp, unsigned int sz) -> Ints"""
return _RMF_HDF5._IntTraitsBaseClass_read_values_dataset(d, iss, sp, sz)
def _IntTraitsBaseClass_write_values_attribute(a, v):
"""_IntTraitsBaseClass_write_values_attribute(hid_t a, Ints v)"""
return _RMF_HDF5._IntTraitsBaseClass_write_values_attribute(a, v)
def _IntTraitsBaseClass_read_values_attribute(a, sz):
"""_IntTraitsBaseClass_read_values_attribute(hid_t a, unsigned int sz) -> Ints"""
return _RMF_HDF5._IntTraitsBaseClass_read_values_attribute(a, sz)
class _IntsTraitsBase(_object):
"""Proxy of C++ RMF::HDF5::SimplePluralTraits<(RMF::HDF5::IntTraits)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, _IntsTraitsBase, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, _IntsTraitsBase, name)
__repr__ = _swig_repr
BatchOperations = _RMF_HDF5._IntsTraitsBase_BatchOperations
def get_index():
"""get_index() -> int"""
return _RMF_HDF5._IntsTraitsBase_get_index()
get_index = staticmethod(get_index)
def get_null_value():
"""get_null_value() -> Ints"""
return _RMF_HDF5._IntsTraitsBase_get_null_value()
get_null_value = staticmethod(get_null_value)
def get_is_null_value(t):
"""get_is_null_value(Ints t) -> bool"""
return _RMF_HDF5._IntsTraitsBase_get_is_null_value(t)
get_is_null_value = staticmethod(get_is_null_value)
def get_hdf5_fill_type():
"""get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._IntsTraitsBase_get_hdf5_fill_type()
get_hdf5_fill_type = staticmethod(get_hdf5_fill_type)
def get_hdf5_disk_type():
"""get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._IntsTraitsBase_get_hdf5_disk_type()
get_hdf5_disk_type = staticmethod(get_hdf5_disk_type)
def get_hdf5_memory_type():
"""get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._IntsTraitsBase_get_hdf5_memory_type()
get_hdf5_memory_type = staticmethod(get_hdf5_memory_type)
def get_fill_value():
"""get_fill_value() -> Ints"""
return _RMF_HDF5._IntsTraitsBase_get_fill_value()
get_fill_value = staticmethod(get_fill_value)
def get_name():
"""get_name() -> std::string"""
return _RMF_HDF5._IntsTraitsBase_get_name()
get_name = staticmethod(get_name)
def write_value_dataset(d, iss, s, v):
"""write_value_dataset(hid_t d, hid_t iss, hid_t s, Ints v)"""
return _RMF_HDF5._IntsTraitsBase_write_value_dataset(d, iss, s, v)
write_value_dataset = staticmethod(write_value_dataset)
def read_value_dataset(d, iss, sp):
"""read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> Ints"""
return _RMF_HDF5._IntsTraitsBase_read_value_dataset(d, iss, sp)
read_value_dataset = staticmethod(read_value_dataset)
def write_values_dataset(arg1, arg2, arg3, arg4):
"""write_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, IntsList arg4)"""
return _RMF_HDF5._IntsTraitsBase_write_values_dataset(arg1, arg2, arg3, arg4)
write_values_dataset = staticmethod(write_values_dataset)
def read_values_dataset(arg1, arg2, arg3, arg4):
"""read_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, unsigned int arg4) -> IntsList"""
return _RMF_HDF5._IntsTraitsBase_read_values_dataset(arg1, arg2, arg3, arg4)
read_values_dataset = staticmethod(read_values_dataset)
def read_values_attribute(arg1, arg2):
"""read_values_attribute(hid_t arg1, unsigned int arg2) -> IntsList"""
return _RMF_HDF5._IntsTraitsBase_read_values_attribute(arg1, arg2)
read_values_attribute = staticmethod(read_values_attribute)
def write_values_attribute(arg1, arg2):
"""write_values_attribute(hid_t arg1, IntsList arg2)"""
return _RMF_HDF5._IntsTraitsBase_write_values_attribute(arg1, arg2)
write_values_attribute = staticmethod(write_values_attribute)
def __init__(self):
"""__init__(RMF::HDF5::SimplePluralTraits<(RMF::HDF5::IntTraits)> self) -> _IntsTraitsBase"""
this = _RMF_HDF5.new__IntsTraitsBase()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__IntsTraitsBase
__del__ = lambda self: None
_IntsTraitsBase_swigregister = _RMF_HDF5._IntsTraitsBase_swigregister
_IntsTraitsBase_swigregister(_IntsTraitsBase)
def _IntsTraitsBase_get_index():
"""_IntsTraitsBase_get_index() -> int"""
return _RMF_HDF5._IntsTraitsBase_get_index()
def _IntsTraitsBase_get_null_value():
"""_IntsTraitsBase_get_null_value() -> Ints"""
return _RMF_HDF5._IntsTraitsBase_get_null_value()
def _IntsTraitsBase_get_is_null_value(t):
"""_IntsTraitsBase_get_is_null_value(Ints t) -> bool"""
return _RMF_HDF5._IntsTraitsBase_get_is_null_value(t)
def _IntsTraitsBase_get_hdf5_fill_type():
"""_IntsTraitsBase_get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._IntsTraitsBase_get_hdf5_fill_type()
def _IntsTraitsBase_get_hdf5_disk_type():
"""_IntsTraitsBase_get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._IntsTraitsBase_get_hdf5_disk_type()
def _IntsTraitsBase_get_hdf5_memory_type():
"""_IntsTraitsBase_get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._IntsTraitsBase_get_hdf5_memory_type()
def _IntsTraitsBase_get_fill_value():
"""_IntsTraitsBase_get_fill_value() -> Ints"""
return _RMF_HDF5._IntsTraitsBase_get_fill_value()
def _IntsTraitsBase_get_name():
"""_IntsTraitsBase_get_name() -> std::string"""
return _RMF_HDF5._IntsTraitsBase_get_name()
def _IntsTraitsBase_write_value_dataset(d, iss, s, v):
"""_IntsTraitsBase_write_value_dataset(hid_t d, hid_t iss, hid_t s, Ints v)"""
return _RMF_HDF5._IntsTraitsBase_write_value_dataset(d, iss, s, v)
def _IntsTraitsBase_read_value_dataset(d, iss, sp):
"""_IntsTraitsBase_read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> Ints"""
return _RMF_HDF5._IntsTraitsBase_read_value_dataset(d, iss, sp)
def _IntsTraitsBase_write_values_dataset(arg2, arg3, arg4, arg5):
"""_IntsTraitsBase_write_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, IntsList arg5)"""
return _RMF_HDF5._IntsTraitsBase_write_values_dataset(arg2, arg3, arg4, arg5)
def _IntsTraitsBase_read_values_dataset(arg2, arg3, arg4, arg5):
"""_IntsTraitsBase_read_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, unsigned int arg5) -> IntsList"""
return _RMF_HDF5._IntsTraitsBase_read_values_dataset(arg2, arg3, arg4, arg5)
def _IntsTraitsBase_read_values_attribute(arg2, arg3):
"""_IntsTraitsBase_read_values_attribute(hid_t arg2, unsigned int arg3) -> IntsList"""
return _RMF_HDF5._IntsTraitsBase_read_values_attribute(arg2, arg3)
def _IntsTraitsBase_write_values_attribute(arg2, arg3):
"""_IntsTraitsBase_write_values_attribute(hid_t arg2, IntsList arg3)"""
return _RMF_HDF5._IntsTraitsBase_write_values_attribute(arg2, arg3)
class _FloatTraitsBaseClass(FloatTraitsBase):
"""Proxy of C++ RMF::HDF5::SimpleTraits<(RMF::HDF5::FloatTraitsBase)> class."""
__swig_setmethods__ = {}
for _s in [FloatTraitsBase]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _FloatTraitsBaseClass, name, value)
__swig_getmethods__ = {}
for _s in [FloatTraitsBase]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _FloatTraitsBaseClass, name)
__repr__ = _swig_repr
def write_value_dataset(d, iss, s, v):
"""write_value_dataset(hid_t d, hid_t iss, hid_t s, RMF::HDF5::FloatTraitsBase::Type v)"""
return _RMF_HDF5._FloatTraitsBaseClass_write_value_dataset(d, iss, s, v)
write_value_dataset = staticmethod(write_value_dataset)
def read_value_dataset(d, iss, sp):
"""read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> RMF::HDF5::FloatTraitsBase::Type"""
return _RMF_HDF5._FloatTraitsBaseClass_read_value_dataset(d, iss, sp)
read_value_dataset = staticmethod(read_value_dataset)
def write_values_dataset(d, iss, s, v):
"""write_values_dataset(hid_t d, hid_t iss, hid_t s, Floats v)"""
return _RMF_HDF5._FloatTraitsBaseClass_write_values_dataset(d, iss, s, v)
write_values_dataset = staticmethod(write_values_dataset)
def read_values_dataset(d, iss, sp, sz):
"""read_values_dataset(hid_t d, hid_t iss, hid_t sp, unsigned int sz) -> Floats"""
return _RMF_HDF5._FloatTraitsBaseClass_read_values_dataset(d, iss, sp, sz)
read_values_dataset = staticmethod(read_values_dataset)
def write_values_attribute(a, v):
"""write_values_attribute(hid_t a, Floats v)"""
return _RMF_HDF5._FloatTraitsBaseClass_write_values_attribute(a, v)
write_values_attribute = staticmethod(write_values_attribute)
def read_values_attribute(a, sz):
"""read_values_attribute(hid_t a, unsigned int sz) -> Floats"""
return _RMF_HDF5._FloatTraitsBaseClass_read_values_attribute(a, sz)
read_values_attribute = staticmethod(read_values_attribute)
def __init__(self):
"""__init__(RMF::HDF5::SimpleTraits<(RMF::HDF5::FloatTraitsBase)> self) -> _FloatTraitsBaseClass"""
this = _RMF_HDF5.new__FloatTraitsBaseClass()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__FloatTraitsBaseClass
__del__ = lambda self: None
_FloatTraitsBaseClass_swigregister = _RMF_HDF5._FloatTraitsBaseClass_swigregister
_FloatTraitsBaseClass_swigregister(_FloatTraitsBaseClass)
def _FloatTraitsBaseClass_write_value_dataset(d, iss, s, v):
"""_FloatTraitsBaseClass_write_value_dataset(hid_t d, hid_t iss, hid_t s, RMF::HDF5::FloatTraitsBase::Type v)"""
return _RMF_HDF5._FloatTraitsBaseClass_write_value_dataset(d, iss, s, v)
def _FloatTraitsBaseClass_read_value_dataset(d, iss, sp):
"""_FloatTraitsBaseClass_read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> RMF::HDF5::FloatTraitsBase::Type"""
return _RMF_HDF5._FloatTraitsBaseClass_read_value_dataset(d, iss, sp)
def _FloatTraitsBaseClass_write_values_dataset(d, iss, s, v):
"""_FloatTraitsBaseClass_write_values_dataset(hid_t d, hid_t iss, hid_t s, Floats v)"""
return _RMF_HDF5._FloatTraitsBaseClass_write_values_dataset(d, iss, s, v)
def _FloatTraitsBaseClass_read_values_dataset(d, iss, sp, sz):
"""_FloatTraitsBaseClass_read_values_dataset(hid_t d, hid_t iss, hid_t sp, unsigned int sz) -> Floats"""
return _RMF_HDF5._FloatTraitsBaseClass_read_values_dataset(d, iss, sp, sz)
def _FloatTraitsBaseClass_write_values_attribute(a, v):
"""_FloatTraitsBaseClass_write_values_attribute(hid_t a, Floats v)"""
return _RMF_HDF5._FloatTraitsBaseClass_write_values_attribute(a, v)
def _FloatTraitsBaseClass_read_values_attribute(a, sz):
"""_FloatTraitsBaseClass_read_values_attribute(hid_t a, unsigned int sz) -> Floats"""
return _RMF_HDF5._FloatTraitsBaseClass_read_values_attribute(a, sz)
class _FloatsTraitsBase(_object):
"""Proxy of C++ RMF::HDF5::SimplePluralTraits<(RMF::HDF5::FloatTraits)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, _FloatsTraitsBase, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, _FloatsTraitsBase, name)
__repr__ = _swig_repr
BatchOperations = _RMF_HDF5._FloatsTraitsBase_BatchOperations
def get_index():
"""get_index() -> int"""
return _RMF_HDF5._FloatsTraitsBase_get_index()
get_index = staticmethod(get_index)
def get_null_value():
"""get_null_value() -> Floats"""
return _RMF_HDF5._FloatsTraitsBase_get_null_value()
get_null_value = staticmethod(get_null_value)
def get_is_null_value(t):
"""get_is_null_value(Floats t) -> bool"""
return _RMF_HDF5._FloatsTraitsBase_get_is_null_value(t)
get_is_null_value = staticmethod(get_is_null_value)
def get_hdf5_fill_type():
"""get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._FloatsTraitsBase_get_hdf5_fill_type()
get_hdf5_fill_type = staticmethod(get_hdf5_fill_type)
def get_hdf5_disk_type():
"""get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._FloatsTraitsBase_get_hdf5_disk_type()
get_hdf5_disk_type = staticmethod(get_hdf5_disk_type)
def get_hdf5_memory_type():
"""get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._FloatsTraitsBase_get_hdf5_memory_type()
get_hdf5_memory_type = staticmethod(get_hdf5_memory_type)
def get_fill_value():
"""get_fill_value() -> Floats"""
return _RMF_HDF5._FloatsTraitsBase_get_fill_value()
get_fill_value = staticmethod(get_fill_value)
def get_name():
"""get_name() -> std::string"""
return _RMF_HDF5._FloatsTraitsBase_get_name()
get_name = staticmethod(get_name)
def write_value_dataset(d, iss, s, v):
"""write_value_dataset(hid_t d, hid_t iss, hid_t s, Floats v)"""
return _RMF_HDF5._FloatsTraitsBase_write_value_dataset(d, iss, s, v)
write_value_dataset = staticmethod(write_value_dataset)
def read_value_dataset(d, iss, sp):
"""read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> Floats"""
return _RMF_HDF5._FloatsTraitsBase_read_value_dataset(d, iss, sp)
read_value_dataset = staticmethod(read_value_dataset)
def write_values_dataset(arg1, arg2, arg3, arg4):
"""write_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, FloatsList arg4)"""
return _RMF_HDF5._FloatsTraitsBase_write_values_dataset(arg1, arg2, arg3, arg4)
write_values_dataset = staticmethod(write_values_dataset)
def read_values_dataset(arg1, arg2, arg3, arg4):
"""read_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, unsigned int arg4) -> FloatsList"""
return _RMF_HDF5._FloatsTraitsBase_read_values_dataset(arg1, arg2, arg3, arg4)
read_values_dataset = staticmethod(read_values_dataset)
def read_values_attribute(arg1, arg2):
"""read_values_attribute(hid_t arg1, unsigned int arg2) -> FloatsList"""
return _RMF_HDF5._FloatsTraitsBase_read_values_attribute(arg1, arg2)
read_values_attribute = staticmethod(read_values_attribute)
def write_values_attribute(arg1, arg2):
"""write_values_attribute(hid_t arg1, FloatsList arg2)"""
return _RMF_HDF5._FloatsTraitsBase_write_values_attribute(arg1, arg2)
write_values_attribute = staticmethod(write_values_attribute)
def __init__(self):
"""__init__(RMF::HDF5::SimplePluralTraits<(RMF::HDF5::FloatTraits)> self) -> _FloatsTraitsBase"""
this = _RMF_HDF5.new__FloatsTraitsBase()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__FloatsTraitsBase
__del__ = lambda self: None
_FloatsTraitsBase_swigregister = _RMF_HDF5._FloatsTraitsBase_swigregister
_FloatsTraitsBase_swigregister(_FloatsTraitsBase)
def _FloatsTraitsBase_get_index():
"""_FloatsTraitsBase_get_index() -> int"""
return _RMF_HDF5._FloatsTraitsBase_get_index()
def _FloatsTraitsBase_get_null_value():
"""_FloatsTraitsBase_get_null_value() -> Floats"""
return _RMF_HDF5._FloatsTraitsBase_get_null_value()
def _FloatsTraitsBase_get_is_null_value(t):
"""_FloatsTraitsBase_get_is_null_value(Floats t) -> bool"""
return _RMF_HDF5._FloatsTraitsBase_get_is_null_value(t)
def _FloatsTraitsBase_get_hdf5_fill_type():
"""_FloatsTraitsBase_get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._FloatsTraitsBase_get_hdf5_fill_type()
def _FloatsTraitsBase_get_hdf5_disk_type():
"""_FloatsTraitsBase_get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._FloatsTraitsBase_get_hdf5_disk_type()
def _FloatsTraitsBase_get_hdf5_memory_type():
"""_FloatsTraitsBase_get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._FloatsTraitsBase_get_hdf5_memory_type()
def _FloatsTraitsBase_get_fill_value():
"""_FloatsTraitsBase_get_fill_value() -> Floats"""
return _RMF_HDF5._FloatsTraitsBase_get_fill_value()
def _FloatsTraitsBase_get_name():
"""_FloatsTraitsBase_get_name() -> std::string"""
return _RMF_HDF5._FloatsTraitsBase_get_name()
def _FloatsTraitsBase_write_value_dataset(d, iss, s, v):
"""_FloatsTraitsBase_write_value_dataset(hid_t d, hid_t iss, hid_t s, Floats v)"""
return _RMF_HDF5._FloatsTraitsBase_write_value_dataset(d, iss, s, v)
def _FloatsTraitsBase_read_value_dataset(d, iss, sp):
"""_FloatsTraitsBase_read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> Floats"""
return _RMF_HDF5._FloatsTraitsBase_read_value_dataset(d, iss, sp)
def _FloatsTraitsBase_write_values_dataset(arg2, arg3, arg4, arg5):
"""_FloatsTraitsBase_write_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, FloatsList arg5)"""
return _RMF_HDF5._FloatsTraitsBase_write_values_dataset(arg2, arg3, arg4, arg5)
def _FloatsTraitsBase_read_values_dataset(arg2, arg3, arg4, arg5):
"""_FloatsTraitsBase_read_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, unsigned int arg5) -> FloatsList"""
return _RMF_HDF5._FloatsTraitsBase_read_values_dataset(arg2, arg3, arg4, arg5)
def _FloatsTraitsBase_read_values_attribute(arg2, arg3):
"""_FloatsTraitsBase_read_values_attribute(hid_t arg2, unsigned int arg3) -> FloatsList"""
return _RMF_HDF5._FloatsTraitsBase_read_values_attribute(arg2, arg3)
def _FloatsTraitsBase_write_values_attribute(arg2, arg3):
"""_FloatsTraitsBase_write_values_attribute(hid_t arg2, FloatsList arg3)"""
return _RMF_HDF5._FloatsTraitsBase_write_values_attribute(arg2, arg3)
class _IndexTraitsBaseClass(IndexTraitsBase):
"""Proxy of C++ RMF::HDF5::SimpleTraits<(RMF::HDF5::IndexTraitsBase)> class."""
__swig_setmethods__ = {}
for _s in [IndexTraitsBase]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _IndexTraitsBaseClass, name, value)
__swig_getmethods__ = {}
for _s in [IndexTraitsBase]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _IndexTraitsBaseClass, name)
__repr__ = _swig_repr
def write_value_dataset(d, iss, s, v):
"""write_value_dataset(hid_t d, hid_t iss, hid_t s, RMF::HDF5::IndexTraitsBase::Type v)"""
return _RMF_HDF5._IndexTraitsBaseClass_write_value_dataset(d, iss, s, v)
write_value_dataset = staticmethod(write_value_dataset)
def read_value_dataset(d, iss, sp):
"""read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> RMF::HDF5::IndexTraitsBase::Type"""
return _RMF_HDF5._IndexTraitsBaseClass_read_value_dataset(d, iss, sp)
read_value_dataset = staticmethod(read_value_dataset)
def write_values_dataset(d, iss, s, v):
"""write_values_dataset(hid_t d, hid_t iss, hid_t s, Ints v)"""
return _RMF_HDF5._IndexTraitsBaseClass_write_values_dataset(d, iss, s, v)
write_values_dataset = staticmethod(write_values_dataset)
def read_values_dataset(d, iss, sp, sz):
"""read_values_dataset(hid_t d, hid_t iss, hid_t sp, unsigned int sz) -> Ints"""
return _RMF_HDF5._IndexTraitsBaseClass_read_values_dataset(d, iss, sp, sz)
read_values_dataset = staticmethod(read_values_dataset)
def write_values_attribute(a, v):
"""write_values_attribute(hid_t a, Ints v)"""
return _RMF_HDF5._IndexTraitsBaseClass_write_values_attribute(a, v)
write_values_attribute = staticmethod(write_values_attribute)
def read_values_attribute(a, sz):
"""read_values_attribute(hid_t a, unsigned int sz) -> Ints"""
return _RMF_HDF5._IndexTraitsBaseClass_read_values_attribute(a, sz)
read_values_attribute = staticmethod(read_values_attribute)
def __init__(self):
"""__init__(RMF::HDF5::SimpleTraits<(RMF::HDF5::IndexTraitsBase)> self) -> _IndexTraitsBaseClass"""
this = _RMF_HDF5.new__IndexTraitsBaseClass()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__IndexTraitsBaseClass
__del__ = lambda self: None
_IndexTraitsBaseClass_swigregister = _RMF_HDF5._IndexTraitsBaseClass_swigregister
_IndexTraitsBaseClass_swigregister(_IndexTraitsBaseClass)
def _IndexTraitsBaseClass_write_value_dataset(d, iss, s, v):
"""_IndexTraitsBaseClass_write_value_dataset(hid_t d, hid_t iss, hid_t s, RMF::HDF5::IndexTraitsBase::Type v)"""
return _RMF_HDF5._IndexTraitsBaseClass_write_value_dataset(d, iss, s, v)
def _IndexTraitsBaseClass_read_value_dataset(d, iss, sp):
"""_IndexTraitsBaseClass_read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> RMF::HDF5::IndexTraitsBase::Type"""
return _RMF_HDF5._IndexTraitsBaseClass_read_value_dataset(d, iss, sp)
def _IndexTraitsBaseClass_write_values_dataset(d, iss, s, v):
"""_IndexTraitsBaseClass_write_values_dataset(hid_t d, hid_t iss, hid_t s, Ints v)"""
return _RMF_HDF5._IndexTraitsBaseClass_write_values_dataset(d, iss, s, v)
def _IndexTraitsBaseClass_read_values_dataset(d, iss, sp, sz):
"""_IndexTraitsBaseClass_read_values_dataset(hid_t d, hid_t iss, hid_t sp, unsigned int sz) -> Ints"""
return _RMF_HDF5._IndexTraitsBaseClass_read_values_dataset(d, iss, sp, sz)
def _IndexTraitsBaseClass_write_values_attribute(a, v):
"""_IndexTraitsBaseClass_write_values_attribute(hid_t a, Ints v)"""
return _RMF_HDF5._IndexTraitsBaseClass_write_values_attribute(a, v)
def _IndexTraitsBaseClass_read_values_attribute(a, sz):
"""_IndexTraitsBaseClass_read_values_attribute(hid_t a, unsigned int sz) -> Ints"""
return _RMF_HDF5._IndexTraitsBaseClass_read_values_attribute(a, sz)
class _IndexesTraitsBase(_object):
"""Proxy of C++ RMF::HDF5::SimplePluralTraits<(RMF::HDF5::IndexTraits)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, _IndexesTraitsBase, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, _IndexesTraitsBase, name)
__repr__ = _swig_repr
BatchOperations = _RMF_HDF5._IndexesTraitsBase_BatchOperations
def get_index():
"""get_index() -> int"""
return _RMF_HDF5._IndexesTraitsBase_get_index()
get_index = staticmethod(get_index)
def get_null_value():
"""get_null_value() -> Ints"""
return _RMF_HDF5._IndexesTraitsBase_get_null_value()
get_null_value = staticmethod(get_null_value)
def get_is_null_value(t):
"""get_is_null_value(Ints t) -> bool"""
return _RMF_HDF5._IndexesTraitsBase_get_is_null_value(t)
get_is_null_value = staticmethod(get_is_null_value)
def get_hdf5_fill_type():
"""get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._IndexesTraitsBase_get_hdf5_fill_type()
get_hdf5_fill_type = staticmethod(get_hdf5_fill_type)
def get_hdf5_disk_type():
"""get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._IndexesTraitsBase_get_hdf5_disk_type()
get_hdf5_disk_type = staticmethod(get_hdf5_disk_type)
def get_hdf5_memory_type():
"""get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._IndexesTraitsBase_get_hdf5_memory_type()
get_hdf5_memory_type = staticmethod(get_hdf5_memory_type)
def get_fill_value():
"""get_fill_value() -> Ints"""
return _RMF_HDF5._IndexesTraitsBase_get_fill_value()
get_fill_value = staticmethod(get_fill_value)
def get_name():
"""get_name() -> std::string"""
return _RMF_HDF5._IndexesTraitsBase_get_name()
get_name = staticmethod(get_name)
def write_value_dataset(d, iss, s, v):
"""write_value_dataset(hid_t d, hid_t iss, hid_t s, Ints v)"""
return _RMF_HDF5._IndexesTraitsBase_write_value_dataset(d, iss, s, v)
write_value_dataset = staticmethod(write_value_dataset)
def read_value_dataset(d, iss, sp):
"""read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> Ints"""
return _RMF_HDF5._IndexesTraitsBase_read_value_dataset(d, iss, sp)
read_value_dataset = staticmethod(read_value_dataset)
def write_values_dataset(arg1, arg2, arg3, arg4):
"""write_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, IntsList arg4)"""
return _RMF_HDF5._IndexesTraitsBase_write_values_dataset(arg1, arg2, arg3, arg4)
write_values_dataset = staticmethod(write_values_dataset)
def read_values_dataset(arg1, arg2, arg3, arg4):
"""read_values_dataset(hid_t arg1, hid_t arg2, hid_t arg3, unsigned int arg4) -> IntsList"""
return _RMF_HDF5._IndexesTraitsBase_read_values_dataset(arg1, arg2, arg3, arg4)
read_values_dataset = staticmethod(read_values_dataset)
def read_values_attribute(arg1, arg2):
"""read_values_attribute(hid_t arg1, unsigned int arg2) -> IntsList"""
return _RMF_HDF5._IndexesTraitsBase_read_values_attribute(arg1, arg2)
read_values_attribute = staticmethod(read_values_attribute)
def write_values_attribute(arg1, arg2):
"""write_values_attribute(hid_t arg1, IntsList arg2)"""
return _RMF_HDF5._IndexesTraitsBase_write_values_attribute(arg1, arg2)
write_values_attribute = staticmethod(write_values_attribute)
def __init__(self):
"""__init__(RMF::HDF5::SimplePluralTraits<(RMF::HDF5::IndexTraits)> self) -> _IndexesTraitsBase"""
this = _RMF_HDF5.new__IndexesTraitsBase()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__IndexesTraitsBase
__del__ = lambda self: None
_IndexesTraitsBase_swigregister = _RMF_HDF5._IndexesTraitsBase_swigregister
_IndexesTraitsBase_swigregister(_IndexesTraitsBase)
def _IndexesTraitsBase_get_index():
"""_IndexesTraitsBase_get_index() -> int"""
return _RMF_HDF5._IndexesTraitsBase_get_index()
def _IndexesTraitsBase_get_null_value():
"""_IndexesTraitsBase_get_null_value() -> Ints"""
return _RMF_HDF5._IndexesTraitsBase_get_null_value()
def _IndexesTraitsBase_get_is_null_value(t):
"""_IndexesTraitsBase_get_is_null_value(Ints t) -> bool"""
return _RMF_HDF5._IndexesTraitsBase_get_is_null_value(t)
def _IndexesTraitsBase_get_hdf5_fill_type():
"""_IndexesTraitsBase_get_hdf5_fill_type() -> hid_t"""
return _RMF_HDF5._IndexesTraitsBase_get_hdf5_fill_type()
def _IndexesTraitsBase_get_hdf5_disk_type():
"""_IndexesTraitsBase_get_hdf5_disk_type() -> hid_t"""
return _RMF_HDF5._IndexesTraitsBase_get_hdf5_disk_type()
def _IndexesTraitsBase_get_hdf5_memory_type():
"""_IndexesTraitsBase_get_hdf5_memory_type() -> hid_t"""
return _RMF_HDF5._IndexesTraitsBase_get_hdf5_memory_type()
def _IndexesTraitsBase_get_fill_value():
"""_IndexesTraitsBase_get_fill_value() -> Ints"""
return _RMF_HDF5._IndexesTraitsBase_get_fill_value()
def _IndexesTraitsBase_get_name():
"""_IndexesTraitsBase_get_name() -> std::string"""
return _RMF_HDF5._IndexesTraitsBase_get_name()
def _IndexesTraitsBase_write_value_dataset(d, iss, s, v):
"""_IndexesTraitsBase_write_value_dataset(hid_t d, hid_t iss, hid_t s, Ints v)"""
return _RMF_HDF5._IndexesTraitsBase_write_value_dataset(d, iss, s, v)
def _IndexesTraitsBase_read_value_dataset(d, iss, sp):
"""_IndexesTraitsBase_read_value_dataset(hid_t d, hid_t iss, hid_t sp) -> Ints"""
return _RMF_HDF5._IndexesTraitsBase_read_value_dataset(d, iss, sp)
def _IndexesTraitsBase_write_values_dataset(arg2, arg3, arg4, arg5):
"""_IndexesTraitsBase_write_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, IntsList arg5)"""
return _RMF_HDF5._IndexesTraitsBase_write_values_dataset(arg2, arg3, arg4, arg5)
def _IndexesTraitsBase_read_values_dataset(arg2, arg3, arg4, arg5):
"""_IndexesTraitsBase_read_values_dataset(hid_t arg2, hid_t arg3, hid_t arg4, unsigned int arg5) -> IntsList"""
return _RMF_HDF5._IndexesTraitsBase_read_values_dataset(arg2, arg3, arg4, arg5)
def _IndexesTraitsBase_read_values_attribute(arg2, arg3):
"""_IndexesTraitsBase_read_values_attribute(hid_t arg2, unsigned int arg3) -> IntsList"""
return _RMF_HDF5._IndexesTraitsBase_read_values_attribute(arg2, arg3)
def _IndexesTraitsBase_write_values_attribute(arg2, arg3):
"""_IndexesTraitsBase_write_values_attribute(hid_t arg2, IntsList arg3)"""
return _RMF_HDF5._IndexesTraitsBase_write_values_attribute(arg2, arg3)
class _IntTraits(_IntTraitsBaseClass):
"""Proxy of C++ RMF::HDF5::IntTraits class."""
__swig_setmethods__ = {}
for _s in [_IntTraitsBaseClass]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _IntTraits, name, value)
__swig_getmethods__ = {}
for _s in [_IntTraitsBaseClass]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _IntTraits, name)
__repr__ = _swig_repr
def __init__(self):
"""__init__(RMF::HDF5::IntTraits self) -> _IntTraits"""
this = _RMF_HDF5.new__IntTraits()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__IntTraits
__del__ = lambda self: None
_IntTraits_swigregister = _RMF_HDF5._IntTraits_swigregister
_IntTraits_swigregister(_IntTraits)
class _IntsTraits(_IntsTraitsBase):
"""Proxy of C++ RMF::HDF5::IntsTraits class."""
__swig_setmethods__ = {}
for _s in [_IntsTraitsBase]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _IntsTraits, name, value)
__swig_getmethods__ = {}
for _s in [_IntsTraitsBase]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _IntsTraits, name)
__repr__ = _swig_repr
def __init__(self):
"""__init__(RMF::HDF5::IntsTraits self) -> _IntsTraits"""
this = _RMF_HDF5.new__IntsTraits()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__IntsTraits
__del__ = lambda self: None
_IntsTraits_swigregister = _RMF_HDF5._IntsTraits_swigregister
_IntsTraits_swigregister(_IntsTraits)
class _FloatTraits(_FloatTraitsBaseClass):
"""Proxy of C++ RMF::HDF5::FloatTraits class."""
__swig_setmethods__ = {}
for _s in [_FloatTraitsBaseClass]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _FloatTraits, name, value)
__swig_getmethods__ = {}
for _s in [_FloatTraitsBaseClass]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _FloatTraits, name)
__repr__ = _swig_repr
def __init__(self):
"""__init__(RMF::HDF5::FloatTraits self) -> _FloatTraits"""
this = _RMF_HDF5.new__FloatTraits()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__FloatTraits
__del__ = lambda self: None
_FloatTraits_swigregister = _RMF_HDF5._FloatTraits_swigregister
_FloatTraits_swigregister(_FloatTraits)
class _FloatsTraits(_FloatsTraitsBase):
"""Proxy of C++ RMF::HDF5::FloatsTraits class."""
__swig_setmethods__ = {}
for _s in [_FloatsTraitsBase]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _FloatsTraits, name, value)
__swig_getmethods__ = {}
for _s in [_FloatsTraitsBase]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _FloatsTraits, name)
__repr__ = _swig_repr
def __init__(self):
"""__init__(RMF::HDF5::FloatsTraits self) -> _FloatsTraits"""
this = _RMF_HDF5.new__FloatsTraits()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__FloatsTraits
__del__ = lambda self: None
_FloatsTraits_swigregister = _RMF_HDF5._FloatsTraits_swigregister
_FloatsTraits_swigregister(_FloatsTraits)
class _IndexTraits(_IndexTraitsBaseClass):
"""Proxy of C++ RMF::HDF5::IndexTraits class."""
__swig_setmethods__ = {}
for _s in [_IndexTraitsBaseClass]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _IndexTraits, name, value)
__swig_getmethods__ = {}
for _s in [_IndexTraitsBaseClass]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _IndexTraits, name)
__repr__ = _swig_repr
def __init__(self):
"""__init__(RMF::HDF5::IndexTraits self) -> _IndexTraits"""
this = _RMF_HDF5.new__IndexTraits()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__IndexTraits
__del__ = lambda self: None
_IndexTraits_swigregister = _RMF_HDF5._IndexTraits_swigregister
_IndexTraits_swigregister(_IndexTraits)
class _IndexesTraits(_IndexesTraitsBase):
"""Proxy of C++ RMF::HDF5::IndexesTraits class."""
__swig_setmethods__ = {}
for _s in [_IndexesTraitsBase]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _IndexesTraits, name, value)
__swig_getmethods__ = {}
for _s in [_IndexesTraitsBase]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _IndexesTraits, name)
__repr__ = _swig_repr
def __init__(self):
"""__init__(RMF::HDF5::IndexesTraits self) -> _IndexesTraits"""
this = _RMF_HDF5.new__IndexesTraits()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _RMF_HDF5.delete__IndexesTraits
__del__ = lambda self: None
_IndexesTraits_swigregister = _RMF_HDF5._IndexesTraits_swigregister
_IndexesTraits_swigregister(_IndexesTraits)
class Object(_object):
"""Proxy of C++ RMF::HDF5::Object class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Object, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Object, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
def get_name(self):
"""get_name(Object self) -> std::string"""
return _RMF_HDF5.Object_get_name(self)
def get_file(self):
"""get_file(Object self) -> File"""
return _RMF_HDF5.Object_get_file(self)
def __str__(self):
"""__str__(Object self) -> std::string"""
return _RMF_HDF5.Object___str__(self)
def __repr__(self):
"""__repr__(Object self) -> std::string"""
return _RMF_HDF5.Object___repr__(self)
def get_handle(self):
"""get_handle(Object self) -> hid_t"""
return _RMF_HDF5.Object_get_handle(self)
__swig_destroy__ = _RMF_HDF5.delete_Object
__del__ = lambda self: None
Object_swigregister = _RMF_HDF5.Object_swigregister
Object_swigregister(Object)
class _ConstAttributesObject(Object):
"""Proxy of C++ RMF::HDF5::ConstAttributes<(RMF::HDF5::Object)> class."""
__swig_setmethods__ = {}
for _s in [Object]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _ConstAttributesObject, name, value)
__swig_getmethods__ = {}
for _s in [Object]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _ConstAttributesObject, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def get_has_attribute(self, nm):
"""get_has_attribute(_ConstAttributesObject self, std::string nm) -> bool"""
return _RMF_HDF5._ConstAttributesObject_get_has_attribute(self, nm)
def get_int_attribute(self, nm):
"""get_int_attribute(_ConstAttributesObject self, std::string nm) -> Ints"""
return _RMF_HDF5._ConstAttributesObject_get_int_attribute(self, nm)
def get_float_attribute(self, nm):
"""get_float_attribute(_ConstAttributesObject self, std::string nm) -> Floats"""
return _RMF_HDF5._ConstAttributesObject_get_float_attribute(self, nm)
def get_index_attribute(self, nm):
"""get_index_attribute(_ConstAttributesObject self, std::string nm) -> Ints"""
return _RMF_HDF5._ConstAttributesObject_get_index_attribute(self, nm)
def get_char_attribute(self, nm):
"""get_char_attribute(_ConstAttributesObject self, std::string nm) -> std::string"""
return _RMF_HDF5._ConstAttributesObject_get_char_attribute(self, nm)
__swig_destroy__ = _RMF_HDF5.delete__ConstAttributesObject
__del__ = lambda self: None
_ConstAttributesObject_swigregister = _RMF_HDF5._ConstAttributesObject_swigregister
_ConstAttributesObject_swigregister(_ConstAttributesObject)
class DataSetIndex1D(_object):
"""Proxy of C++ RMF::HDF5::DataSetIndexD<(1)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, DataSetIndex1D, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, DataSetIndex1D, name)
def __init__(self, *args):
"""
__init__(RMF::HDF5::DataSetIndexD<(1)> self, Ints o) -> DataSetIndex1D
__init__(RMF::HDF5::DataSetIndexD<(1)> self) -> DataSetIndex1D
__init__(RMF::HDF5::DataSetIndexD<(1)> self, unsigned int i) -> DataSetIndex1D
__init__(RMF::HDF5::DataSetIndexD<(1)> self, unsigned int i, unsigned int j) -> DataSetIndex1D
__init__(RMF::HDF5::DataSetIndexD<(1)> self, unsigned int i, unsigned int j, unsigned int k) -> DataSetIndex1D
"""
this = _RMF_HDF5.new_DataSetIndex1D(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __getitem__(self, i):
"""__getitem__(DataSetIndex1D self, unsigned int i) -> int"""
return _RMF_HDF5.DataSetIndex1D___getitem__(self, i)
def get_dimension(self):
"""get_dimension(DataSetIndex1D self) -> unsigned int"""
return _RMF_HDF5.DataSetIndex1D_get_dimension(self)
def __str__(self):
"""__str__(DataSetIndex1D self) -> std::string"""
return _RMF_HDF5.DataSetIndex1D___str__(self)
def __repr__(self):
"""__repr__(DataSetIndex1D self) -> std::string"""
return _RMF_HDF5.DataSetIndex1D___repr__(self)
def __eq__(self, o):
"""__eq__(DataSetIndex1D self, DataSetIndex1D o) -> bool"""
return _RMF_HDF5.DataSetIndex1D___eq__(self, o)
def __ne__(self, o):
"""__ne__(DataSetIndex1D self, DataSetIndex1D o) -> bool"""
return _RMF_HDF5.DataSetIndex1D___ne__(self, o)
def __lt__(self, o):
"""__lt__(DataSetIndex1D self, DataSetIndex1D o) -> bool"""
return _RMF_HDF5.DataSetIndex1D___lt__(self, o)
def __gt__(self, o):
"""__gt__(DataSetIndex1D self, DataSetIndex1D o) -> bool"""
return _RMF_HDF5.DataSetIndex1D___gt__(self, o)
def __ge__(self, o):
"""__ge__(DataSetIndex1D self, DataSetIndex1D o) -> bool"""
return _RMF_HDF5.DataSetIndex1D___ge__(self, o)
def __le__(self, o):
"""__le__(DataSetIndex1D self, DataSetIndex1D o) -> bool"""
return _RMF_HDF5.DataSetIndex1D___le__(self, o)
def __hash__(self):
"""__hash__(DataSetIndex1D self) -> std::size_t"""
return _RMF_HDF5.DataSetIndex1D___hash__(self)
__swig_destroy__ = _RMF_HDF5.delete_DataSetIndex1D
__del__ = lambda self: None
DataSetIndex1D_swigregister = _RMF_HDF5.DataSetIndex1D_swigregister
DataSetIndex1D_swigregister(DataSetIndex1D)
class DataSetIndex2D(_object):
"""Proxy of C++ RMF::HDF5::DataSetIndexD<(2)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, DataSetIndex2D, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, DataSetIndex2D, name)
def __init__(self, *args):
"""
__init__(RMF::HDF5::DataSetIndexD<(2)> self, Ints o) -> DataSetIndex2D
__init__(RMF::HDF5::DataSetIndexD<(2)> self) -> DataSetIndex2D
__init__(RMF::HDF5::DataSetIndexD<(2)> self, unsigned int i) -> DataSetIndex2D
__init__(RMF::HDF5::DataSetIndexD<(2)> self, unsigned int i, unsigned int j) -> DataSetIndex2D
__init__(RMF::HDF5::DataSetIndexD<(2)> self, unsigned int i, unsigned int j, unsigned int k) -> DataSetIndex2D
"""
this = _RMF_HDF5.new_DataSetIndex2D(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __getitem__(self, i):
"""__getitem__(DataSetIndex2D self, unsigned int i) -> int"""
return _RMF_HDF5.DataSetIndex2D___getitem__(self, i)
def get_dimension(self):
"""get_dimension(DataSetIndex2D self) -> unsigned int"""
return _RMF_HDF5.DataSetIndex2D_get_dimension(self)
def __str__(self):
"""__str__(DataSetIndex2D self) -> std::string"""
return _RMF_HDF5.DataSetIndex2D___str__(self)
def __repr__(self):
"""__repr__(DataSetIndex2D self) -> std::string"""
return _RMF_HDF5.DataSetIndex2D___repr__(self)
def __eq__(self, o):
"""__eq__(DataSetIndex2D self, DataSetIndex2D o) -> bool"""
return _RMF_HDF5.DataSetIndex2D___eq__(self, o)
def __ne__(self, o):
"""__ne__(DataSetIndex2D self, DataSetIndex2D o) -> bool"""
return _RMF_HDF5.DataSetIndex2D___ne__(self, o)
def __lt__(self, o):
"""__lt__(DataSetIndex2D self, DataSetIndex2D o) -> bool"""
return _RMF_HDF5.DataSetIndex2D___lt__(self, o)
def __gt__(self, o):
"""__gt__(DataSetIndex2D self, DataSetIndex2D o) -> bool"""
return _RMF_HDF5.DataSetIndex2D___gt__(self, o)
def __ge__(self, o):
"""__ge__(DataSetIndex2D self, DataSetIndex2D o) -> bool"""
return _RMF_HDF5.DataSetIndex2D___ge__(self, o)
def __le__(self, o):
"""__le__(DataSetIndex2D self, DataSetIndex2D o) -> bool"""
return _RMF_HDF5.DataSetIndex2D___le__(self, o)
def __hash__(self):
"""__hash__(DataSetIndex2D self) -> std::size_t"""
return _RMF_HDF5.DataSetIndex2D___hash__(self)
__swig_destroy__ = _RMF_HDF5.delete_DataSetIndex2D
__del__ = lambda self: None
DataSetIndex2D_swigregister = _RMF_HDF5.DataSetIndex2D_swigregister
DataSetIndex2D_swigregister(DataSetIndex2D)
class DataSetIndex3D(_object):
"""Proxy of C++ RMF::HDF5::DataSetIndexD<(3)> class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, DataSetIndex3D, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, DataSetIndex3D, name)
def __init__(self, *args):
"""
__init__(RMF::HDF5::DataSetIndexD<(3)> self, Ints o) -> DataSetIndex3D
__init__(RMF::HDF5::DataSetIndexD<(3)> self) -> DataSetIndex3D
__init__(RMF::HDF5::DataSetIndexD<(3)> self, unsigned int i) -> DataSetIndex3D
__init__(RMF::HDF5::DataSetIndexD<(3)> self, unsigned int i, unsigned int j) -> DataSetIndex3D
__init__(RMF::HDF5::DataSetIndexD<(3)> self, unsigned int i, unsigned int j, unsigned int k) -> DataSetIndex3D
"""
this = _RMF_HDF5.new_DataSetIndex3D(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __getitem__(self, i):
"""__getitem__(DataSetIndex3D self, unsigned int i) -> int"""
return _RMF_HDF5.DataSetIndex3D___getitem__(self, i)
def get_dimension(self):
"""get_dimension(DataSetIndex3D self) -> unsigned int"""
return _RMF_HDF5.DataSetIndex3D_get_dimension(self)
def __str__(self):
"""__str__(DataSetIndex3D self) -> std::string"""
return _RMF_HDF5.DataSetIndex3D___str__(self)
def __repr__(self):
"""__repr__(DataSetIndex3D self) -> std::string"""
return _RMF_HDF5.DataSetIndex3D___repr__(self)
def __eq__(self, o):
"""__eq__(DataSetIndex3D self, DataSetIndex3D o) -> bool"""
return _RMF_HDF5.DataSetIndex3D___eq__(self, o)
def __ne__(self, o):
"""__ne__(DataSetIndex3D self, DataSetIndex3D o) -> bool"""
return _RMF_HDF5.DataSetIndex3D___ne__(self, o)
def __lt__(self, o):
"""__lt__(DataSetIndex3D self, DataSetIndex3D o) -> bool"""
return _RMF_HDF5.DataSetIndex3D___lt__(self, o)
def __gt__(self, o):
"""__gt__(DataSetIndex3D self, DataSetIndex3D o) -> bool"""
return _RMF_HDF5.DataSetIndex3D___gt__(self, o)
def __ge__(self, o):
"""__ge__(DataSetIndex3D self, DataSetIndex3D o) -> bool"""
return _RMF_HDF5.DataSetIndex3D___ge__(self, o)
def __le__(self, o):
"""__le__(DataSetIndex3D self, DataSetIndex3D o) -> bool"""
return _RMF_HDF5.DataSetIndex3D___le__(self, o)
def __hash__(self):
"""__hash__(DataSetIndex3D self) -> std::size_t"""
return _RMF_HDF5.DataSetIndex3D___hash__(self)
__swig_destroy__ = _RMF_HDF5.delete_DataSetIndex3D
__del__ = lambda self: None
DataSetIndex3D_swigregister = _RMF_HDF5.DataSetIndex3D_swigregister
DataSetIndex3D_swigregister(DataSetIndex3D)
GZIP_COMPRESSION = _RMF_HDF5.GZIP_COMPRESSION
SLIB_COMPRESSION = _RMF_HDF5.SLIB_COMPRESSION
NO_COMPRESSION = _RMF_HDF5.NO_COMPRESSION
class IntConstDataSet1D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntConstDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntConstDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntTraits,1)> self) -> IntConstDataSet1D"""
this = _RMF_HDF5.new_IntConstDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IntConstDataSet1D self) -> DataSetIndex1D"""
return _RMF_HDF5.IntConstDataSet1D_get_size(self)
def get_value(self, ijk):
"""get_value(IntConstDataSet1D self, DataSetIndex1D ijk) -> RMF::HDF5::IntTraits::Type"""
return _RMF_HDF5.IntConstDataSet1D_get_value(self, ijk)
def __str__(self):
"""__str__(IntConstDataSet1D self) -> std::string"""
return _RMF_HDF5.IntConstDataSet1D___str__(self)
def __repr__(self):
"""__repr__(IntConstDataSet1D self) -> std::string"""
return _RMF_HDF5.IntConstDataSet1D___repr__(self)
def get_block(self, lb, size):
"""get_block(IntConstDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size) -> Ints"""
return _RMF_HDF5.IntConstDataSet1D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IntConstDataSet1D self, IntConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntConstDataSet1D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IntConstDataSet1D self, IntConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntConstDataSet1D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IntConstDataSet1D self, IntConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntConstDataSet1D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IntConstDataSet1D self, IntConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntConstDataSet1D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IntConstDataSet1D self, IntConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntConstDataSet1D___ge__(self, o)
def __le__(self, o):
"""__le__(IntConstDataSet1D self, IntConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntConstDataSet1D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IntConstDataSet1D
__del__ = lambda self: None
IntConstDataSet1D_swigregister = _RMF_HDF5.IntConstDataSet1D_swigregister
IntConstDataSet1D_swigregister(IntConstDataSet1D)
class IntConstDataSet2D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntConstDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntConstDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntTraits,2)> self) -> IntConstDataSet2D"""
this = _RMF_HDF5.new_IntConstDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IntConstDataSet2D self) -> DataSetIndex2D"""
return _RMF_HDF5.IntConstDataSet2D_get_size(self)
def get_value(self, ijk):
"""get_value(IntConstDataSet2D self, DataSetIndex2D ijk) -> RMF::HDF5::IntTraits::Type"""
return _RMF_HDF5.IntConstDataSet2D_get_value(self, ijk)
def __str__(self):
"""__str__(IntConstDataSet2D self) -> std::string"""
return _RMF_HDF5.IntConstDataSet2D___str__(self)
def __repr__(self):
"""__repr__(IntConstDataSet2D self) -> std::string"""
return _RMF_HDF5.IntConstDataSet2D___repr__(self)
def get_block(self, lb, size):
"""get_block(IntConstDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size) -> Ints"""
return _RMF_HDF5.IntConstDataSet2D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IntConstDataSet2D self, IntConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntConstDataSet2D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IntConstDataSet2D self, IntConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntConstDataSet2D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IntConstDataSet2D self, IntConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntConstDataSet2D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IntConstDataSet2D self, IntConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntConstDataSet2D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IntConstDataSet2D self, IntConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntConstDataSet2D___ge__(self, o)
def __le__(self, o):
"""__le__(IntConstDataSet2D self, IntConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntConstDataSet2D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IntConstDataSet2D
__del__ = lambda self: None
IntConstDataSet2D_swigregister = _RMF_HDF5.IntConstDataSet2D_swigregister
IntConstDataSet2D_swigregister(IntConstDataSet2D)
class IntConstDataSet3D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntConstDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntConstDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntTraits,3)> self) -> IntConstDataSet3D"""
this = _RMF_HDF5.new_IntConstDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IntConstDataSet3D self) -> DataSetIndex3D"""
return _RMF_HDF5.IntConstDataSet3D_get_size(self)
def get_value(self, ijk):
"""get_value(IntConstDataSet3D self, DataSetIndex3D ijk) -> RMF::HDF5::IntTraits::Type"""
return _RMF_HDF5.IntConstDataSet3D_get_value(self, ijk)
def __str__(self):
"""__str__(IntConstDataSet3D self) -> std::string"""
return _RMF_HDF5.IntConstDataSet3D___str__(self)
def __repr__(self):
"""__repr__(IntConstDataSet3D self) -> std::string"""
return _RMF_HDF5.IntConstDataSet3D___repr__(self)
def get_block(self, lb, size):
"""get_block(IntConstDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size) -> Ints"""
return _RMF_HDF5.IntConstDataSet3D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IntConstDataSet3D self, IntConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntConstDataSet3D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IntConstDataSet3D self, IntConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntConstDataSet3D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IntConstDataSet3D self, IntConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntConstDataSet3D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IntConstDataSet3D self, IntConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntConstDataSet3D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IntConstDataSet3D self, IntConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntConstDataSet3D___ge__(self, o)
def __le__(self, o):
"""__le__(IntConstDataSet3D self, IntConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntConstDataSet3D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IntConstDataSet3D
__del__ = lambda self: None
IntConstDataSet3D_swigregister = _RMF_HDF5.IntConstDataSet3D_swigregister
IntConstDataSet3D_swigregister(IntConstDataSet3D)
class IntDataSetAttributes1D(IntConstDataSet1D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntTraits,1)>)> class."""
__swig_setmethods__ = {}
for _s in [IntConstDataSet1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntDataSetAttributes1D, name, value)
__swig_getmethods__ = {}
for _s in [IntConstDataSet1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntDataSetAttributes1D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IntDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntDataSetAttributes1D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IntDataSetAttributes1D self, std::string nm, Floats value)"""
return _RMF_HDF5.IntDataSetAttributes1D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IntDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntDataSetAttributes1D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IntDataSetAttributes1D self, std::string nm, std::string value)"""
return _RMF_HDF5.IntDataSetAttributes1D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IntDataSetAttributes1D
__del__ = lambda self: None
IntDataSetAttributes1D_swigregister = _RMF_HDF5.IntDataSetAttributes1D_swigregister
IntDataSetAttributes1D_swigregister(IntDataSetAttributes1D)
class IntDataSetAttributes2D(IntConstDataSet2D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntTraits,2)>)> class."""
__swig_setmethods__ = {}
for _s in [IntConstDataSet2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntDataSetAttributes2D, name, value)
__swig_getmethods__ = {}
for _s in [IntConstDataSet2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntDataSetAttributes2D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IntDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntDataSetAttributes2D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IntDataSetAttributes2D self, std::string nm, Floats value)"""
return _RMF_HDF5.IntDataSetAttributes2D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IntDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntDataSetAttributes2D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IntDataSetAttributes2D self, std::string nm, std::string value)"""
return _RMF_HDF5.IntDataSetAttributes2D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IntDataSetAttributes2D
__del__ = lambda self: None
IntDataSetAttributes2D_swigregister = _RMF_HDF5.IntDataSetAttributes2D_swigregister
IntDataSetAttributes2D_swigregister(IntDataSetAttributes2D)
class IntDataSetAttributes3D(IntConstDataSet3D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntTraits,3)>)> class."""
__swig_setmethods__ = {}
for _s in [IntConstDataSet3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntDataSetAttributes3D, name, value)
__swig_getmethods__ = {}
for _s in [IntConstDataSet3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntDataSetAttributes3D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IntDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntDataSetAttributes3D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IntDataSetAttributes3D self, std::string nm, Floats value)"""
return _RMF_HDF5.IntDataSetAttributes3D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IntDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntDataSetAttributes3D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IntDataSetAttributes3D self, std::string nm, std::string value)"""
return _RMF_HDF5.IntDataSetAttributes3D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IntDataSetAttributes3D
__del__ = lambda self: None
IntDataSetAttributes3D_swigregister = _RMF_HDF5.IntDataSetAttributes3D_swigregister
IntDataSetAttributes3D_swigregister(IntDataSetAttributes3D)
class IntsConstDataSet1D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntsTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntsConstDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntsConstDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntsTraits,1)> self) -> IntsConstDataSet1D"""
this = _RMF_HDF5.new_IntsConstDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IntsConstDataSet1D self) -> DataSetIndex1D"""
return _RMF_HDF5.IntsConstDataSet1D_get_size(self)
def get_value(self, ijk):
"""get_value(IntsConstDataSet1D self, DataSetIndex1D ijk) -> Ints"""
return _RMF_HDF5.IntsConstDataSet1D_get_value(self, ijk)
def __str__(self):
"""__str__(IntsConstDataSet1D self) -> std::string"""
return _RMF_HDF5.IntsConstDataSet1D___str__(self)
def __repr__(self):
"""__repr__(IntsConstDataSet1D self) -> std::string"""
return _RMF_HDF5.IntsConstDataSet1D___repr__(self)
def get_block(self, lb, size):
"""get_block(IntsConstDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size) -> IntsList"""
return _RMF_HDF5.IntsConstDataSet1D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IntsConstDataSet1D self, IntsConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet1D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IntsConstDataSet1D self, IntsConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet1D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IntsConstDataSet1D self, IntsConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet1D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IntsConstDataSet1D self, IntsConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet1D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IntsConstDataSet1D self, IntsConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet1D___ge__(self, o)
def __le__(self, o):
"""__le__(IntsConstDataSet1D self, IntsConstDataSet1D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet1D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IntsConstDataSet1D
__del__ = lambda self: None
IntsConstDataSet1D_swigregister = _RMF_HDF5.IntsConstDataSet1D_swigregister
IntsConstDataSet1D_swigregister(IntsConstDataSet1D)
class IntsConstDataSet2D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntsTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntsConstDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntsConstDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntsTraits,2)> self) -> IntsConstDataSet2D"""
this = _RMF_HDF5.new_IntsConstDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IntsConstDataSet2D self) -> DataSetIndex2D"""
return _RMF_HDF5.IntsConstDataSet2D_get_size(self)
def get_value(self, ijk):
"""get_value(IntsConstDataSet2D self, DataSetIndex2D ijk) -> Ints"""
return _RMF_HDF5.IntsConstDataSet2D_get_value(self, ijk)
def __str__(self):
"""__str__(IntsConstDataSet2D self) -> std::string"""
return _RMF_HDF5.IntsConstDataSet2D___str__(self)
def __repr__(self):
"""__repr__(IntsConstDataSet2D self) -> std::string"""
return _RMF_HDF5.IntsConstDataSet2D___repr__(self)
def get_block(self, lb, size):
"""get_block(IntsConstDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size) -> IntsList"""
return _RMF_HDF5.IntsConstDataSet2D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IntsConstDataSet2D self, IntsConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet2D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IntsConstDataSet2D self, IntsConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet2D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IntsConstDataSet2D self, IntsConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet2D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IntsConstDataSet2D self, IntsConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet2D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IntsConstDataSet2D self, IntsConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet2D___ge__(self, o)
def __le__(self, o):
"""__le__(IntsConstDataSet2D self, IntsConstDataSet2D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet2D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IntsConstDataSet2D
__del__ = lambda self: None
IntsConstDataSet2D_swigregister = _RMF_HDF5.IntsConstDataSet2D_swigregister
IntsConstDataSet2D_swigregister(IntsConstDataSet2D)
class IntsConstDataSet3D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntsTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntsConstDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntsConstDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntsTraits,3)> self) -> IntsConstDataSet3D"""
this = _RMF_HDF5.new_IntsConstDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IntsConstDataSet3D self) -> DataSetIndex3D"""
return _RMF_HDF5.IntsConstDataSet3D_get_size(self)
def get_value(self, ijk):
"""get_value(IntsConstDataSet3D self, DataSetIndex3D ijk) -> Ints"""
return _RMF_HDF5.IntsConstDataSet3D_get_value(self, ijk)
def __str__(self):
"""__str__(IntsConstDataSet3D self) -> std::string"""
return _RMF_HDF5.IntsConstDataSet3D___str__(self)
def __repr__(self):
"""__repr__(IntsConstDataSet3D self) -> std::string"""
return _RMF_HDF5.IntsConstDataSet3D___repr__(self)
def get_block(self, lb, size):
"""get_block(IntsConstDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size) -> IntsList"""
return _RMF_HDF5.IntsConstDataSet3D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IntsConstDataSet3D self, IntsConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet3D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IntsConstDataSet3D self, IntsConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet3D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IntsConstDataSet3D self, IntsConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet3D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IntsConstDataSet3D self, IntsConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet3D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IntsConstDataSet3D self, IntsConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet3D___ge__(self, o)
def __le__(self, o):
"""__le__(IntsConstDataSet3D self, IntsConstDataSet3D o) -> bool"""
return _RMF_HDF5.IntsConstDataSet3D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IntsConstDataSet3D
__del__ = lambda self: None
IntsConstDataSet3D_swigregister = _RMF_HDF5.IntsConstDataSet3D_swigregister
IntsConstDataSet3D_swigregister(IntsConstDataSet3D)
class IntsDataSetAttributes1D(IntsConstDataSet1D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntsTraits,1)>)> class."""
__swig_setmethods__ = {}
for _s in [IntsConstDataSet1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntsDataSetAttributes1D, name, value)
__swig_getmethods__ = {}
for _s in [IntsConstDataSet1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntsDataSetAttributes1D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IntsDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntsDataSetAttributes1D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IntsDataSetAttributes1D self, std::string nm, Floats value)"""
return _RMF_HDF5.IntsDataSetAttributes1D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IntsDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntsDataSetAttributes1D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IntsDataSetAttributes1D self, std::string nm, std::string value)"""
return _RMF_HDF5.IntsDataSetAttributes1D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IntsDataSetAttributes1D
__del__ = lambda self: None
IntsDataSetAttributes1D_swigregister = _RMF_HDF5.IntsDataSetAttributes1D_swigregister
IntsDataSetAttributes1D_swigregister(IntsDataSetAttributes1D)
class IntsDataSetAttributes2D(IntsConstDataSet2D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntsTraits,2)>)> class."""
__swig_setmethods__ = {}
for _s in [IntsConstDataSet2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntsDataSetAttributes2D, name, value)
__swig_getmethods__ = {}
for _s in [IntsConstDataSet2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntsDataSetAttributes2D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IntsDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntsDataSetAttributes2D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IntsDataSetAttributes2D self, std::string nm, Floats value)"""
return _RMF_HDF5.IntsDataSetAttributes2D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IntsDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntsDataSetAttributes2D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IntsDataSetAttributes2D self, std::string nm, std::string value)"""
return _RMF_HDF5.IntsDataSetAttributes2D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IntsDataSetAttributes2D
__del__ = lambda self: None
IntsDataSetAttributes2D_swigregister = _RMF_HDF5.IntsDataSetAttributes2D_swigregister
IntsDataSetAttributes2D_swigregister(IntsDataSetAttributes2D)
class IntsDataSetAttributes3D(IntsConstDataSet3D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IntsTraits,3)>)> class."""
__swig_setmethods__ = {}
for _s in [IntsConstDataSet3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntsDataSetAttributes3D, name, value)
__swig_getmethods__ = {}
for _s in [IntsConstDataSet3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntsDataSetAttributes3D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IntsDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntsDataSetAttributes3D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IntsDataSetAttributes3D self, std::string nm, Floats value)"""
return _RMF_HDF5.IntsDataSetAttributes3D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IntsDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.IntsDataSetAttributes3D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IntsDataSetAttributes3D self, std::string nm, std::string value)"""
return _RMF_HDF5.IntsDataSetAttributes3D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IntsDataSetAttributes3D
__del__ = lambda self: None
IntsDataSetAttributes3D_swigregister = _RMF_HDF5.IntsDataSetAttributes3D_swigregister
IntsDataSetAttributes3D_swigregister(IntsDataSetAttributes3D)
class FloatConstDataSet1D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatConstDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatConstDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatTraits,1)> self) -> FloatConstDataSet1D"""
this = _RMF_HDF5.new_FloatConstDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(FloatConstDataSet1D self) -> DataSetIndex1D"""
return _RMF_HDF5.FloatConstDataSet1D_get_size(self)
def get_value(self, ijk):
"""get_value(FloatConstDataSet1D self, DataSetIndex1D ijk) -> RMF::HDF5::FloatTraits::Type"""
return _RMF_HDF5.FloatConstDataSet1D_get_value(self, ijk)
def __str__(self):
"""__str__(FloatConstDataSet1D self) -> std::string"""
return _RMF_HDF5.FloatConstDataSet1D___str__(self)
def __repr__(self):
"""__repr__(FloatConstDataSet1D self) -> std::string"""
return _RMF_HDF5.FloatConstDataSet1D___repr__(self)
def get_block(self, lb, size):
"""get_block(FloatConstDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size) -> Floats"""
return _RMF_HDF5.FloatConstDataSet1D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(FloatConstDataSet1D self, FloatConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet1D___eq__(self, o)
def __ne__(self, o):
"""__ne__(FloatConstDataSet1D self, FloatConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet1D___ne__(self, o)
def __lt__(self, o):
"""__lt__(FloatConstDataSet1D self, FloatConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet1D___lt__(self, o)
def __gt__(self, o):
"""__gt__(FloatConstDataSet1D self, FloatConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet1D___gt__(self, o)
def __ge__(self, o):
"""__ge__(FloatConstDataSet1D self, FloatConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet1D___ge__(self, o)
def __le__(self, o):
"""__le__(FloatConstDataSet1D self, FloatConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet1D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_FloatConstDataSet1D
__del__ = lambda self: None
FloatConstDataSet1D_swigregister = _RMF_HDF5.FloatConstDataSet1D_swigregister
FloatConstDataSet1D_swigregister(FloatConstDataSet1D)
class FloatConstDataSet2D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatConstDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatConstDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatTraits,2)> self) -> FloatConstDataSet2D"""
this = _RMF_HDF5.new_FloatConstDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(FloatConstDataSet2D self) -> DataSetIndex2D"""
return _RMF_HDF5.FloatConstDataSet2D_get_size(self)
def get_value(self, ijk):
"""get_value(FloatConstDataSet2D self, DataSetIndex2D ijk) -> RMF::HDF5::FloatTraits::Type"""
return _RMF_HDF5.FloatConstDataSet2D_get_value(self, ijk)
def __str__(self):
"""__str__(FloatConstDataSet2D self) -> std::string"""
return _RMF_HDF5.FloatConstDataSet2D___str__(self)
def __repr__(self):
"""__repr__(FloatConstDataSet2D self) -> std::string"""
return _RMF_HDF5.FloatConstDataSet2D___repr__(self)
def get_block(self, lb, size):
"""get_block(FloatConstDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size) -> Floats"""
return _RMF_HDF5.FloatConstDataSet2D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(FloatConstDataSet2D self, FloatConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet2D___eq__(self, o)
def __ne__(self, o):
"""__ne__(FloatConstDataSet2D self, FloatConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet2D___ne__(self, o)
def __lt__(self, o):
"""__lt__(FloatConstDataSet2D self, FloatConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet2D___lt__(self, o)
def __gt__(self, o):
"""__gt__(FloatConstDataSet2D self, FloatConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet2D___gt__(self, o)
def __ge__(self, o):
"""__ge__(FloatConstDataSet2D self, FloatConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet2D___ge__(self, o)
def __le__(self, o):
"""__le__(FloatConstDataSet2D self, FloatConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet2D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_FloatConstDataSet2D
__del__ = lambda self: None
FloatConstDataSet2D_swigregister = _RMF_HDF5.FloatConstDataSet2D_swigregister
FloatConstDataSet2D_swigregister(FloatConstDataSet2D)
class FloatConstDataSet3D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatConstDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatConstDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatTraits,3)> self) -> FloatConstDataSet3D"""
this = _RMF_HDF5.new_FloatConstDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(FloatConstDataSet3D self) -> DataSetIndex3D"""
return _RMF_HDF5.FloatConstDataSet3D_get_size(self)
def get_value(self, ijk):
"""get_value(FloatConstDataSet3D self, DataSetIndex3D ijk) -> RMF::HDF5::FloatTraits::Type"""
return _RMF_HDF5.FloatConstDataSet3D_get_value(self, ijk)
def __str__(self):
"""__str__(FloatConstDataSet3D self) -> std::string"""
return _RMF_HDF5.FloatConstDataSet3D___str__(self)
def __repr__(self):
"""__repr__(FloatConstDataSet3D self) -> std::string"""
return _RMF_HDF5.FloatConstDataSet3D___repr__(self)
def get_block(self, lb, size):
"""get_block(FloatConstDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size) -> Floats"""
return _RMF_HDF5.FloatConstDataSet3D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(FloatConstDataSet3D self, FloatConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet3D___eq__(self, o)
def __ne__(self, o):
"""__ne__(FloatConstDataSet3D self, FloatConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet3D___ne__(self, o)
def __lt__(self, o):
"""__lt__(FloatConstDataSet3D self, FloatConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet3D___lt__(self, o)
def __gt__(self, o):
"""__gt__(FloatConstDataSet3D self, FloatConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet3D___gt__(self, o)
def __ge__(self, o):
"""__ge__(FloatConstDataSet3D self, FloatConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet3D___ge__(self, o)
def __le__(self, o):
"""__le__(FloatConstDataSet3D self, FloatConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatConstDataSet3D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_FloatConstDataSet3D
__del__ = lambda self: None
FloatConstDataSet3D_swigregister = _RMF_HDF5.FloatConstDataSet3D_swigregister
FloatConstDataSet3D_swigregister(FloatConstDataSet3D)
class FloatDataSetAttributes1D(FloatConstDataSet1D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatTraits,1)>)> class."""
__swig_setmethods__ = {}
for _s in [FloatConstDataSet1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatDataSetAttributes1D, name, value)
__swig_getmethods__ = {}
for _s in [FloatConstDataSet1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatDataSetAttributes1D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(FloatDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatDataSetAttributes1D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(FloatDataSetAttributes1D self, std::string nm, Floats value)"""
return _RMF_HDF5.FloatDataSetAttributes1D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(FloatDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatDataSetAttributes1D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(FloatDataSetAttributes1D self, std::string nm, std::string value)"""
return _RMF_HDF5.FloatDataSetAttributes1D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_FloatDataSetAttributes1D
__del__ = lambda self: None
FloatDataSetAttributes1D_swigregister = _RMF_HDF5.FloatDataSetAttributes1D_swigregister
FloatDataSetAttributes1D_swigregister(FloatDataSetAttributes1D)
class FloatDataSetAttributes2D(FloatConstDataSet2D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatTraits,2)>)> class."""
__swig_setmethods__ = {}
for _s in [FloatConstDataSet2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatDataSetAttributes2D, name, value)
__swig_getmethods__ = {}
for _s in [FloatConstDataSet2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatDataSetAttributes2D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(FloatDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatDataSetAttributes2D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(FloatDataSetAttributes2D self, std::string nm, Floats value)"""
return _RMF_HDF5.FloatDataSetAttributes2D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(FloatDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatDataSetAttributes2D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(FloatDataSetAttributes2D self, std::string nm, std::string value)"""
return _RMF_HDF5.FloatDataSetAttributes2D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_FloatDataSetAttributes2D
__del__ = lambda self: None
FloatDataSetAttributes2D_swigregister = _RMF_HDF5.FloatDataSetAttributes2D_swigregister
FloatDataSetAttributes2D_swigregister(FloatDataSetAttributes2D)
class FloatDataSetAttributes3D(FloatConstDataSet3D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatTraits,3)>)> class."""
__swig_setmethods__ = {}
for _s in [FloatConstDataSet3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatDataSetAttributes3D, name, value)
__swig_getmethods__ = {}
for _s in [FloatConstDataSet3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatDataSetAttributes3D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(FloatDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatDataSetAttributes3D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(FloatDataSetAttributes3D self, std::string nm, Floats value)"""
return _RMF_HDF5.FloatDataSetAttributes3D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(FloatDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatDataSetAttributes3D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(FloatDataSetAttributes3D self, std::string nm, std::string value)"""
return _RMF_HDF5.FloatDataSetAttributes3D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_FloatDataSetAttributes3D
__del__ = lambda self: None
FloatDataSetAttributes3D_swigregister = _RMF_HDF5.FloatDataSetAttributes3D_swigregister
FloatDataSetAttributes3D_swigregister(FloatDataSetAttributes3D)
class FloatsConstDataSet1D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatsTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatsConstDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatsConstDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatsTraits,1)> self) -> FloatsConstDataSet1D"""
this = _RMF_HDF5.new_FloatsConstDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(FloatsConstDataSet1D self) -> DataSetIndex1D"""
return _RMF_HDF5.FloatsConstDataSet1D_get_size(self)
def get_value(self, ijk):
"""get_value(FloatsConstDataSet1D self, DataSetIndex1D ijk) -> Floats"""
return _RMF_HDF5.FloatsConstDataSet1D_get_value(self, ijk)
def __str__(self):
"""__str__(FloatsConstDataSet1D self) -> std::string"""
return _RMF_HDF5.FloatsConstDataSet1D___str__(self)
def __repr__(self):
"""__repr__(FloatsConstDataSet1D self) -> std::string"""
return _RMF_HDF5.FloatsConstDataSet1D___repr__(self)
def get_block(self, lb, size):
"""get_block(FloatsConstDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size) -> FloatsList"""
return _RMF_HDF5.FloatsConstDataSet1D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(FloatsConstDataSet1D self, FloatsConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet1D___eq__(self, o)
def __ne__(self, o):
"""__ne__(FloatsConstDataSet1D self, FloatsConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet1D___ne__(self, o)
def __lt__(self, o):
"""__lt__(FloatsConstDataSet1D self, FloatsConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet1D___lt__(self, o)
def __gt__(self, o):
"""__gt__(FloatsConstDataSet1D self, FloatsConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet1D___gt__(self, o)
def __ge__(self, o):
"""__ge__(FloatsConstDataSet1D self, FloatsConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet1D___ge__(self, o)
def __le__(self, o):
"""__le__(FloatsConstDataSet1D self, FloatsConstDataSet1D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet1D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_FloatsConstDataSet1D
__del__ = lambda self: None
FloatsConstDataSet1D_swigregister = _RMF_HDF5.FloatsConstDataSet1D_swigregister
FloatsConstDataSet1D_swigregister(FloatsConstDataSet1D)
class FloatsConstDataSet2D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatsTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatsConstDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatsConstDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatsTraits,2)> self) -> FloatsConstDataSet2D"""
this = _RMF_HDF5.new_FloatsConstDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(FloatsConstDataSet2D self) -> DataSetIndex2D"""
return _RMF_HDF5.FloatsConstDataSet2D_get_size(self)
def get_value(self, ijk):
"""get_value(FloatsConstDataSet2D self, DataSetIndex2D ijk) -> Floats"""
return _RMF_HDF5.FloatsConstDataSet2D_get_value(self, ijk)
def __str__(self):
"""__str__(FloatsConstDataSet2D self) -> std::string"""
return _RMF_HDF5.FloatsConstDataSet2D___str__(self)
def __repr__(self):
"""__repr__(FloatsConstDataSet2D self) -> std::string"""
return _RMF_HDF5.FloatsConstDataSet2D___repr__(self)
def get_block(self, lb, size):
"""get_block(FloatsConstDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size) -> FloatsList"""
return _RMF_HDF5.FloatsConstDataSet2D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(FloatsConstDataSet2D self, FloatsConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet2D___eq__(self, o)
def __ne__(self, o):
"""__ne__(FloatsConstDataSet2D self, FloatsConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet2D___ne__(self, o)
def __lt__(self, o):
"""__lt__(FloatsConstDataSet2D self, FloatsConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet2D___lt__(self, o)
def __gt__(self, o):
"""__gt__(FloatsConstDataSet2D self, FloatsConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet2D___gt__(self, o)
def __ge__(self, o):
"""__ge__(FloatsConstDataSet2D self, FloatsConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet2D___ge__(self, o)
def __le__(self, o):
"""__le__(FloatsConstDataSet2D self, FloatsConstDataSet2D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet2D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_FloatsConstDataSet2D
__del__ = lambda self: None
FloatsConstDataSet2D_swigregister = _RMF_HDF5.FloatsConstDataSet2D_swigregister
FloatsConstDataSet2D_swigregister(FloatsConstDataSet2D)
class FloatsConstDataSet3D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatsTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatsConstDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatsConstDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatsTraits,3)> self) -> FloatsConstDataSet3D"""
this = _RMF_HDF5.new_FloatsConstDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(FloatsConstDataSet3D self) -> DataSetIndex3D"""
return _RMF_HDF5.FloatsConstDataSet3D_get_size(self)
def get_value(self, ijk):
"""get_value(FloatsConstDataSet3D self, DataSetIndex3D ijk) -> Floats"""
return _RMF_HDF5.FloatsConstDataSet3D_get_value(self, ijk)
def __str__(self):
"""__str__(FloatsConstDataSet3D self) -> std::string"""
return _RMF_HDF5.FloatsConstDataSet3D___str__(self)
def __repr__(self):
"""__repr__(FloatsConstDataSet3D self) -> std::string"""
return _RMF_HDF5.FloatsConstDataSet3D___repr__(self)
def get_block(self, lb, size):
"""get_block(FloatsConstDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size) -> FloatsList"""
return _RMF_HDF5.FloatsConstDataSet3D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(FloatsConstDataSet3D self, FloatsConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet3D___eq__(self, o)
def __ne__(self, o):
"""__ne__(FloatsConstDataSet3D self, FloatsConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet3D___ne__(self, o)
def __lt__(self, o):
"""__lt__(FloatsConstDataSet3D self, FloatsConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet3D___lt__(self, o)
def __gt__(self, o):
"""__gt__(FloatsConstDataSet3D self, FloatsConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet3D___gt__(self, o)
def __ge__(self, o):
"""__ge__(FloatsConstDataSet3D self, FloatsConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet3D___ge__(self, o)
def __le__(self, o):
"""__le__(FloatsConstDataSet3D self, FloatsConstDataSet3D o) -> bool"""
return _RMF_HDF5.FloatsConstDataSet3D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_FloatsConstDataSet3D
__del__ = lambda self: None
FloatsConstDataSet3D_swigregister = _RMF_HDF5.FloatsConstDataSet3D_swigregister
FloatsConstDataSet3D_swigregister(FloatsConstDataSet3D)
class FloatsDataSetAttributes1D(FloatsConstDataSet1D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatsTraits,1)>)> class."""
__swig_setmethods__ = {}
for _s in [FloatsConstDataSet1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatsDataSetAttributes1D, name, value)
__swig_getmethods__ = {}
for _s in [FloatsConstDataSet1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatsDataSetAttributes1D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(FloatsDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatsDataSetAttributes1D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(FloatsDataSetAttributes1D self, std::string nm, Floats value)"""
return _RMF_HDF5.FloatsDataSetAttributes1D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(FloatsDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatsDataSetAttributes1D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(FloatsDataSetAttributes1D self, std::string nm, std::string value)"""
return _RMF_HDF5.FloatsDataSetAttributes1D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_FloatsDataSetAttributes1D
__del__ = lambda self: None
FloatsDataSetAttributes1D_swigregister = _RMF_HDF5.FloatsDataSetAttributes1D_swigregister
FloatsDataSetAttributes1D_swigregister(FloatsDataSetAttributes1D)
class FloatsDataSetAttributes2D(FloatsConstDataSet2D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatsTraits,2)>)> class."""
__swig_setmethods__ = {}
for _s in [FloatsConstDataSet2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatsDataSetAttributes2D, name, value)
__swig_getmethods__ = {}
for _s in [FloatsConstDataSet2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatsDataSetAttributes2D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(FloatsDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatsDataSetAttributes2D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(FloatsDataSetAttributes2D self, std::string nm, Floats value)"""
return _RMF_HDF5.FloatsDataSetAttributes2D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(FloatsDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatsDataSetAttributes2D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(FloatsDataSetAttributes2D self, std::string nm, std::string value)"""
return _RMF_HDF5.FloatsDataSetAttributes2D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_FloatsDataSetAttributes2D
__del__ = lambda self: None
FloatsDataSetAttributes2D_swigregister = _RMF_HDF5.FloatsDataSetAttributes2D_swigregister
FloatsDataSetAttributes2D_swigregister(FloatsDataSetAttributes2D)
class FloatsDataSetAttributes3D(FloatsConstDataSet3D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::FloatsTraits,3)>)> class."""
__swig_setmethods__ = {}
for _s in [FloatsConstDataSet3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatsDataSetAttributes3D, name, value)
__swig_getmethods__ = {}
for _s in [FloatsConstDataSet3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatsDataSetAttributes3D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(FloatsDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatsDataSetAttributes3D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(FloatsDataSetAttributes3D self, std::string nm, Floats value)"""
return _RMF_HDF5.FloatsDataSetAttributes3D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(FloatsDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.FloatsDataSetAttributes3D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(FloatsDataSetAttributes3D self, std::string nm, std::string value)"""
return _RMF_HDF5.FloatsDataSetAttributes3D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_FloatsDataSetAttributes3D
__del__ = lambda self: None
FloatsDataSetAttributes3D_swigregister = _RMF_HDF5.FloatsDataSetAttributes3D_swigregister
FloatsDataSetAttributes3D_swigregister(FloatsDataSetAttributes3D)
class IndexConstDataSet1D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexConstDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexConstDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexTraits,1)> self) -> IndexConstDataSet1D"""
this = _RMF_HDF5.new_IndexConstDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IndexConstDataSet1D self) -> DataSetIndex1D"""
return _RMF_HDF5.IndexConstDataSet1D_get_size(self)
def get_value(self, ijk):
"""get_value(IndexConstDataSet1D self, DataSetIndex1D ijk) -> RMF::HDF5::IndexTraits::Type"""
return _RMF_HDF5.IndexConstDataSet1D_get_value(self, ijk)
def __str__(self):
"""__str__(IndexConstDataSet1D self) -> std::string"""
return _RMF_HDF5.IndexConstDataSet1D___str__(self)
def __repr__(self):
"""__repr__(IndexConstDataSet1D self) -> std::string"""
return _RMF_HDF5.IndexConstDataSet1D___repr__(self)
def get_block(self, lb, size):
"""get_block(IndexConstDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size) -> Ints"""
return _RMF_HDF5.IndexConstDataSet1D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IndexConstDataSet1D self, IndexConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet1D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IndexConstDataSet1D self, IndexConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet1D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IndexConstDataSet1D self, IndexConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet1D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IndexConstDataSet1D self, IndexConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet1D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IndexConstDataSet1D self, IndexConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet1D___ge__(self, o)
def __le__(self, o):
"""__le__(IndexConstDataSet1D self, IndexConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet1D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IndexConstDataSet1D
__del__ = lambda self: None
IndexConstDataSet1D_swigregister = _RMF_HDF5.IndexConstDataSet1D_swigregister
IndexConstDataSet1D_swigregister(IndexConstDataSet1D)
class IndexConstDataSet2D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexConstDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexConstDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexTraits,2)> self) -> IndexConstDataSet2D"""
this = _RMF_HDF5.new_IndexConstDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IndexConstDataSet2D self) -> DataSetIndex2D"""
return _RMF_HDF5.IndexConstDataSet2D_get_size(self)
def get_value(self, ijk):
"""get_value(IndexConstDataSet2D self, DataSetIndex2D ijk) -> RMF::HDF5::IndexTraits::Type"""
return _RMF_HDF5.IndexConstDataSet2D_get_value(self, ijk)
def __str__(self):
"""__str__(IndexConstDataSet2D self) -> std::string"""
return _RMF_HDF5.IndexConstDataSet2D___str__(self)
def __repr__(self):
"""__repr__(IndexConstDataSet2D self) -> std::string"""
return _RMF_HDF5.IndexConstDataSet2D___repr__(self)
def get_block(self, lb, size):
"""get_block(IndexConstDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size) -> Ints"""
return _RMF_HDF5.IndexConstDataSet2D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IndexConstDataSet2D self, IndexConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet2D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IndexConstDataSet2D self, IndexConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet2D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IndexConstDataSet2D self, IndexConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet2D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IndexConstDataSet2D self, IndexConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet2D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IndexConstDataSet2D self, IndexConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet2D___ge__(self, o)
def __le__(self, o):
"""__le__(IndexConstDataSet2D self, IndexConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet2D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IndexConstDataSet2D
__del__ = lambda self: None
IndexConstDataSet2D_swigregister = _RMF_HDF5.IndexConstDataSet2D_swigregister
IndexConstDataSet2D_swigregister(IndexConstDataSet2D)
class IndexConstDataSet3D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexConstDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexConstDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexTraits,3)> self) -> IndexConstDataSet3D"""
this = _RMF_HDF5.new_IndexConstDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IndexConstDataSet3D self) -> DataSetIndex3D"""
return _RMF_HDF5.IndexConstDataSet3D_get_size(self)
def get_value(self, ijk):
"""get_value(IndexConstDataSet3D self, DataSetIndex3D ijk) -> RMF::HDF5::IndexTraits::Type"""
return _RMF_HDF5.IndexConstDataSet3D_get_value(self, ijk)
def __str__(self):
"""__str__(IndexConstDataSet3D self) -> std::string"""
return _RMF_HDF5.IndexConstDataSet3D___str__(self)
def __repr__(self):
"""__repr__(IndexConstDataSet3D self) -> std::string"""
return _RMF_HDF5.IndexConstDataSet3D___repr__(self)
def get_block(self, lb, size):
"""get_block(IndexConstDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size) -> Ints"""
return _RMF_HDF5.IndexConstDataSet3D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IndexConstDataSet3D self, IndexConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet3D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IndexConstDataSet3D self, IndexConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet3D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IndexConstDataSet3D self, IndexConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet3D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IndexConstDataSet3D self, IndexConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet3D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IndexConstDataSet3D self, IndexConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet3D___ge__(self, o)
def __le__(self, o):
"""__le__(IndexConstDataSet3D self, IndexConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexConstDataSet3D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IndexConstDataSet3D
__del__ = lambda self: None
IndexConstDataSet3D_swigregister = _RMF_HDF5.IndexConstDataSet3D_swigregister
IndexConstDataSet3D_swigregister(IndexConstDataSet3D)
class IndexDataSetAttributes1D(IndexConstDataSet1D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexTraits,1)>)> class."""
__swig_setmethods__ = {}
for _s in [IndexConstDataSet1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexDataSetAttributes1D, name, value)
__swig_getmethods__ = {}
for _s in [IndexConstDataSet1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexDataSetAttributes1D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IndexDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexDataSetAttributes1D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IndexDataSetAttributes1D self, std::string nm, Floats value)"""
return _RMF_HDF5.IndexDataSetAttributes1D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IndexDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexDataSetAttributes1D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IndexDataSetAttributes1D self, std::string nm, std::string value)"""
return _RMF_HDF5.IndexDataSetAttributes1D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IndexDataSetAttributes1D
__del__ = lambda self: None
IndexDataSetAttributes1D_swigregister = _RMF_HDF5.IndexDataSetAttributes1D_swigregister
IndexDataSetAttributes1D_swigregister(IndexDataSetAttributes1D)
class IndexDataSetAttributes2D(IndexConstDataSet2D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexTraits,2)>)> class."""
__swig_setmethods__ = {}
for _s in [IndexConstDataSet2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexDataSetAttributes2D, name, value)
__swig_getmethods__ = {}
for _s in [IndexConstDataSet2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexDataSetAttributes2D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IndexDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexDataSetAttributes2D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IndexDataSetAttributes2D self, std::string nm, Floats value)"""
return _RMF_HDF5.IndexDataSetAttributes2D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IndexDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexDataSetAttributes2D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IndexDataSetAttributes2D self, std::string nm, std::string value)"""
return _RMF_HDF5.IndexDataSetAttributes2D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IndexDataSetAttributes2D
__del__ = lambda self: None
IndexDataSetAttributes2D_swigregister = _RMF_HDF5.IndexDataSetAttributes2D_swigregister
IndexDataSetAttributes2D_swigregister(IndexDataSetAttributes2D)
class IndexDataSetAttributes3D(IndexConstDataSet3D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexTraits,3)>)> class."""
__swig_setmethods__ = {}
for _s in [IndexConstDataSet3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexDataSetAttributes3D, name, value)
__swig_getmethods__ = {}
for _s in [IndexConstDataSet3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexDataSetAttributes3D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IndexDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexDataSetAttributes3D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IndexDataSetAttributes3D self, std::string nm, Floats value)"""
return _RMF_HDF5.IndexDataSetAttributes3D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IndexDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexDataSetAttributes3D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IndexDataSetAttributes3D self, std::string nm, std::string value)"""
return _RMF_HDF5.IndexDataSetAttributes3D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IndexDataSetAttributes3D
__del__ = lambda self: None
IndexDataSetAttributes3D_swigregister = _RMF_HDF5.IndexDataSetAttributes3D_swigregister
IndexDataSetAttributes3D_swigregister(IndexDataSetAttributes3D)
class IndexesConstDataSet1D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexesTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexesConstDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexesConstDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexesTraits,1)> self) -> IndexesConstDataSet1D"""
this = _RMF_HDF5.new_IndexesConstDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IndexesConstDataSet1D self) -> DataSetIndex1D"""
return _RMF_HDF5.IndexesConstDataSet1D_get_size(self)
def get_value(self, ijk):
"""get_value(IndexesConstDataSet1D self, DataSetIndex1D ijk) -> Ints"""
return _RMF_HDF5.IndexesConstDataSet1D_get_value(self, ijk)
def __str__(self):
"""__str__(IndexesConstDataSet1D self) -> std::string"""
return _RMF_HDF5.IndexesConstDataSet1D___str__(self)
def __repr__(self):
"""__repr__(IndexesConstDataSet1D self) -> std::string"""
return _RMF_HDF5.IndexesConstDataSet1D___repr__(self)
def get_block(self, lb, size):
"""get_block(IndexesConstDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size) -> IntsList"""
return _RMF_HDF5.IndexesConstDataSet1D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IndexesConstDataSet1D self, IndexesConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet1D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IndexesConstDataSet1D self, IndexesConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet1D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IndexesConstDataSet1D self, IndexesConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet1D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IndexesConstDataSet1D self, IndexesConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet1D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IndexesConstDataSet1D self, IndexesConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet1D___ge__(self, o)
def __le__(self, o):
"""__le__(IndexesConstDataSet1D self, IndexesConstDataSet1D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet1D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IndexesConstDataSet1D
__del__ = lambda self: None
IndexesConstDataSet1D_swigregister = _RMF_HDF5.IndexesConstDataSet1D_swigregister
IndexesConstDataSet1D_swigregister(IndexesConstDataSet1D)
class IndexesConstDataSet2D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexesTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexesConstDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexesConstDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexesTraits,2)> self) -> IndexesConstDataSet2D"""
this = _RMF_HDF5.new_IndexesConstDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IndexesConstDataSet2D self) -> DataSetIndex2D"""
return _RMF_HDF5.IndexesConstDataSet2D_get_size(self)
def get_value(self, ijk):
"""get_value(IndexesConstDataSet2D self, DataSetIndex2D ijk) -> Ints"""
return _RMF_HDF5.IndexesConstDataSet2D_get_value(self, ijk)
def __str__(self):
"""__str__(IndexesConstDataSet2D self) -> std::string"""
return _RMF_HDF5.IndexesConstDataSet2D___str__(self)
def __repr__(self):
"""__repr__(IndexesConstDataSet2D self) -> std::string"""
return _RMF_HDF5.IndexesConstDataSet2D___repr__(self)
def get_block(self, lb, size):
"""get_block(IndexesConstDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size) -> IntsList"""
return _RMF_HDF5.IndexesConstDataSet2D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IndexesConstDataSet2D self, IndexesConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet2D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IndexesConstDataSet2D self, IndexesConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet2D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IndexesConstDataSet2D self, IndexesConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet2D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IndexesConstDataSet2D self, IndexesConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet2D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IndexesConstDataSet2D self, IndexesConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet2D___ge__(self, o)
def __le__(self, o):
"""__le__(IndexesConstDataSet2D self, IndexesConstDataSet2D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet2D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IndexesConstDataSet2D
__del__ = lambda self: None
IndexesConstDataSet2D_swigregister = _RMF_HDF5.IndexesConstDataSet2D_swigregister
IndexesConstDataSet2D_swigregister(IndexesConstDataSet2D)
class IndexesConstDataSet3D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexesTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexesConstDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexesConstDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexesTraits,3)> self) -> IndexesConstDataSet3D"""
this = _RMF_HDF5.new_IndexesConstDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(IndexesConstDataSet3D self) -> DataSetIndex3D"""
return _RMF_HDF5.IndexesConstDataSet3D_get_size(self)
def get_value(self, ijk):
"""get_value(IndexesConstDataSet3D self, DataSetIndex3D ijk) -> Ints"""
return _RMF_HDF5.IndexesConstDataSet3D_get_value(self, ijk)
def __str__(self):
"""__str__(IndexesConstDataSet3D self) -> std::string"""
return _RMF_HDF5.IndexesConstDataSet3D___str__(self)
def __repr__(self):
"""__repr__(IndexesConstDataSet3D self) -> std::string"""
return _RMF_HDF5.IndexesConstDataSet3D___repr__(self)
def get_block(self, lb, size):
"""get_block(IndexesConstDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size) -> IntsList"""
return _RMF_HDF5.IndexesConstDataSet3D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(IndexesConstDataSet3D self, IndexesConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet3D___eq__(self, o)
def __ne__(self, o):
"""__ne__(IndexesConstDataSet3D self, IndexesConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet3D___ne__(self, o)
def __lt__(self, o):
"""__lt__(IndexesConstDataSet3D self, IndexesConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet3D___lt__(self, o)
def __gt__(self, o):
"""__gt__(IndexesConstDataSet3D self, IndexesConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet3D___gt__(self, o)
def __ge__(self, o):
"""__ge__(IndexesConstDataSet3D self, IndexesConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet3D___ge__(self, o)
def __le__(self, o):
"""__le__(IndexesConstDataSet3D self, IndexesConstDataSet3D o) -> bool"""
return _RMF_HDF5.IndexesConstDataSet3D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_IndexesConstDataSet3D
__del__ = lambda self: None
IndexesConstDataSet3D_swigregister = _RMF_HDF5.IndexesConstDataSet3D_swigregister
IndexesConstDataSet3D_swigregister(IndexesConstDataSet3D)
class IndexesDataSetAttributes1D(IndexesConstDataSet1D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexesTraits,1)>)> class."""
__swig_setmethods__ = {}
for _s in [IndexesConstDataSet1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexesDataSetAttributes1D, name, value)
__swig_getmethods__ = {}
for _s in [IndexesConstDataSet1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexesDataSetAttributes1D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IndexesDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexesDataSetAttributes1D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IndexesDataSetAttributes1D self, std::string nm, Floats value)"""
return _RMF_HDF5.IndexesDataSetAttributes1D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IndexesDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexesDataSetAttributes1D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IndexesDataSetAttributes1D self, std::string nm, std::string value)"""
return _RMF_HDF5.IndexesDataSetAttributes1D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IndexesDataSetAttributes1D
__del__ = lambda self: None
IndexesDataSetAttributes1D_swigregister = _RMF_HDF5.IndexesDataSetAttributes1D_swigregister
IndexesDataSetAttributes1D_swigregister(IndexesDataSetAttributes1D)
class IndexesDataSetAttributes2D(IndexesConstDataSet2D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexesTraits,2)>)> class."""
__swig_setmethods__ = {}
for _s in [IndexesConstDataSet2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexesDataSetAttributes2D, name, value)
__swig_getmethods__ = {}
for _s in [IndexesConstDataSet2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexesDataSetAttributes2D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IndexesDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexesDataSetAttributes2D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IndexesDataSetAttributes2D self, std::string nm, Floats value)"""
return _RMF_HDF5.IndexesDataSetAttributes2D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IndexesDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexesDataSetAttributes2D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IndexesDataSetAttributes2D self, std::string nm, std::string value)"""
return _RMF_HDF5.IndexesDataSetAttributes2D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IndexesDataSetAttributes2D
__del__ = lambda self: None
IndexesDataSetAttributes2D_swigregister = _RMF_HDF5.IndexesDataSetAttributes2D_swigregister
IndexesDataSetAttributes2D_swigregister(IndexesDataSetAttributes2D)
class IndexesDataSetAttributes3D(IndexesConstDataSet3D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::IndexesTraits,3)>)> class."""
__swig_setmethods__ = {}
for _s in [IndexesConstDataSet3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexesDataSetAttributes3D, name, value)
__swig_getmethods__ = {}
for _s in [IndexesConstDataSet3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexesDataSetAttributes3D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(IndexesDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexesDataSetAttributes3D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(IndexesDataSetAttributes3D self, std::string nm, Floats value)"""
return _RMF_HDF5.IndexesDataSetAttributes3D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(IndexesDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.IndexesDataSetAttributes3D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(IndexesDataSetAttributes3D self, std::string nm, std::string value)"""
return _RMF_HDF5.IndexesDataSetAttributes3D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_IndexesDataSetAttributes3D
__del__ = lambda self: None
IndexesDataSetAttributes3D_swigregister = _RMF_HDF5.IndexesDataSetAttributes3D_swigregister
IndexesDataSetAttributes3D_swigregister(IndexesDataSetAttributes3D)
class StringConstDataSet1D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringConstDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringConstDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringTraits,1)> self) -> StringConstDataSet1D"""
this = _RMF_HDF5.new_StringConstDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(StringConstDataSet1D self) -> DataSetIndex1D"""
return _RMF_HDF5.StringConstDataSet1D_get_size(self)
def get_value(self, ijk):
"""get_value(StringConstDataSet1D self, DataSetIndex1D ijk) -> RMF::HDF5::StringTraits::Type"""
return _RMF_HDF5.StringConstDataSet1D_get_value(self, ijk)
def __str__(self):
"""__str__(StringConstDataSet1D self) -> std::string"""
return _RMF_HDF5.StringConstDataSet1D___str__(self)
def __repr__(self):
"""__repr__(StringConstDataSet1D self) -> std::string"""
return _RMF_HDF5.StringConstDataSet1D___repr__(self)
def get_block(self, lb, size):
"""get_block(StringConstDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size) -> Strings"""
return _RMF_HDF5.StringConstDataSet1D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(StringConstDataSet1D self, StringConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringConstDataSet1D___eq__(self, o)
def __ne__(self, o):
"""__ne__(StringConstDataSet1D self, StringConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringConstDataSet1D___ne__(self, o)
def __lt__(self, o):
"""__lt__(StringConstDataSet1D self, StringConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringConstDataSet1D___lt__(self, o)
def __gt__(self, o):
"""__gt__(StringConstDataSet1D self, StringConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringConstDataSet1D___gt__(self, o)
def __ge__(self, o):
"""__ge__(StringConstDataSet1D self, StringConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringConstDataSet1D___ge__(self, o)
def __le__(self, o):
"""__le__(StringConstDataSet1D self, StringConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringConstDataSet1D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_StringConstDataSet1D
__del__ = lambda self: None
StringConstDataSet1D_swigregister = _RMF_HDF5.StringConstDataSet1D_swigregister
StringConstDataSet1D_swigregister(StringConstDataSet1D)
class StringConstDataSet2D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringConstDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringConstDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringTraits,2)> self) -> StringConstDataSet2D"""
this = _RMF_HDF5.new_StringConstDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(StringConstDataSet2D self) -> DataSetIndex2D"""
return _RMF_HDF5.StringConstDataSet2D_get_size(self)
def get_value(self, ijk):
"""get_value(StringConstDataSet2D self, DataSetIndex2D ijk) -> RMF::HDF5::StringTraits::Type"""
return _RMF_HDF5.StringConstDataSet2D_get_value(self, ijk)
def __str__(self):
"""__str__(StringConstDataSet2D self) -> std::string"""
return _RMF_HDF5.StringConstDataSet2D___str__(self)
def __repr__(self):
"""__repr__(StringConstDataSet2D self) -> std::string"""
return _RMF_HDF5.StringConstDataSet2D___repr__(self)
def get_block(self, lb, size):
"""get_block(StringConstDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size) -> Strings"""
return _RMF_HDF5.StringConstDataSet2D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(StringConstDataSet2D self, StringConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringConstDataSet2D___eq__(self, o)
def __ne__(self, o):
"""__ne__(StringConstDataSet2D self, StringConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringConstDataSet2D___ne__(self, o)
def __lt__(self, o):
"""__lt__(StringConstDataSet2D self, StringConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringConstDataSet2D___lt__(self, o)
def __gt__(self, o):
"""__gt__(StringConstDataSet2D self, StringConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringConstDataSet2D___gt__(self, o)
def __ge__(self, o):
"""__ge__(StringConstDataSet2D self, StringConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringConstDataSet2D___ge__(self, o)
def __le__(self, o):
"""__le__(StringConstDataSet2D self, StringConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringConstDataSet2D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_StringConstDataSet2D
__del__ = lambda self: None
StringConstDataSet2D_swigregister = _RMF_HDF5.StringConstDataSet2D_swigregister
StringConstDataSet2D_swigregister(StringConstDataSet2D)
class StringConstDataSet3D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringConstDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringConstDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringTraits,3)> self) -> StringConstDataSet3D"""
this = _RMF_HDF5.new_StringConstDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(StringConstDataSet3D self) -> DataSetIndex3D"""
return _RMF_HDF5.StringConstDataSet3D_get_size(self)
def get_value(self, ijk):
"""get_value(StringConstDataSet3D self, DataSetIndex3D ijk) -> RMF::HDF5::StringTraits::Type"""
return _RMF_HDF5.StringConstDataSet3D_get_value(self, ijk)
def __str__(self):
"""__str__(StringConstDataSet3D self) -> std::string"""
return _RMF_HDF5.StringConstDataSet3D___str__(self)
def __repr__(self):
"""__repr__(StringConstDataSet3D self) -> std::string"""
return _RMF_HDF5.StringConstDataSet3D___repr__(self)
def get_block(self, lb, size):
"""get_block(StringConstDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size) -> Strings"""
return _RMF_HDF5.StringConstDataSet3D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(StringConstDataSet3D self, StringConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringConstDataSet3D___eq__(self, o)
def __ne__(self, o):
"""__ne__(StringConstDataSet3D self, StringConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringConstDataSet3D___ne__(self, o)
def __lt__(self, o):
"""__lt__(StringConstDataSet3D self, StringConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringConstDataSet3D___lt__(self, o)
def __gt__(self, o):
"""__gt__(StringConstDataSet3D self, StringConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringConstDataSet3D___gt__(self, o)
def __ge__(self, o):
"""__ge__(StringConstDataSet3D self, StringConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringConstDataSet3D___ge__(self, o)
def __le__(self, o):
"""__le__(StringConstDataSet3D self, StringConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringConstDataSet3D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_StringConstDataSet3D
__del__ = lambda self: None
StringConstDataSet3D_swigregister = _RMF_HDF5.StringConstDataSet3D_swigregister
StringConstDataSet3D_swigregister(StringConstDataSet3D)
class StringDataSetAttributes1D(StringConstDataSet1D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringTraits,1)>)> class."""
__swig_setmethods__ = {}
for _s in [StringConstDataSet1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringDataSetAttributes1D, name, value)
__swig_getmethods__ = {}
for _s in [StringConstDataSet1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringDataSetAttributes1D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(StringDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringDataSetAttributes1D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(StringDataSetAttributes1D self, std::string nm, Floats value)"""
return _RMF_HDF5.StringDataSetAttributes1D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(StringDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringDataSetAttributes1D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(StringDataSetAttributes1D self, std::string nm, std::string value)"""
return _RMF_HDF5.StringDataSetAttributes1D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_StringDataSetAttributes1D
__del__ = lambda self: None
StringDataSetAttributes1D_swigregister = _RMF_HDF5.StringDataSetAttributes1D_swigregister
StringDataSetAttributes1D_swigregister(StringDataSetAttributes1D)
class StringDataSetAttributes2D(StringConstDataSet2D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringTraits,2)>)> class."""
__swig_setmethods__ = {}
for _s in [StringConstDataSet2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringDataSetAttributes2D, name, value)
__swig_getmethods__ = {}
for _s in [StringConstDataSet2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringDataSetAttributes2D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(StringDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringDataSetAttributes2D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(StringDataSetAttributes2D self, std::string nm, Floats value)"""
return _RMF_HDF5.StringDataSetAttributes2D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(StringDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringDataSetAttributes2D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(StringDataSetAttributes2D self, std::string nm, std::string value)"""
return _RMF_HDF5.StringDataSetAttributes2D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_StringDataSetAttributes2D
__del__ = lambda self: None
StringDataSetAttributes2D_swigregister = _RMF_HDF5.StringDataSetAttributes2D_swigregister
StringDataSetAttributes2D_swigregister(StringDataSetAttributes2D)
class StringDataSetAttributes3D(StringConstDataSet3D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringTraits,3)>)> class."""
__swig_setmethods__ = {}
for _s in [StringConstDataSet3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringDataSetAttributes3D, name, value)
__swig_getmethods__ = {}
for _s in [StringConstDataSet3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringDataSetAttributes3D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(StringDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringDataSetAttributes3D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(StringDataSetAttributes3D self, std::string nm, Floats value)"""
return _RMF_HDF5.StringDataSetAttributes3D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(StringDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringDataSetAttributes3D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(StringDataSetAttributes3D self, std::string nm, std::string value)"""
return _RMF_HDF5.StringDataSetAttributes3D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_StringDataSetAttributes3D
__del__ = lambda self: None
StringDataSetAttributes3D_swigregister = _RMF_HDF5.StringDataSetAttributes3D_swigregister
StringDataSetAttributes3D_swigregister(StringDataSetAttributes3D)
class StringsConstDataSet1D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringsTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringsConstDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringsConstDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringsTraits,1)> self) -> StringsConstDataSet1D"""
this = _RMF_HDF5.new_StringsConstDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(StringsConstDataSet1D self) -> DataSetIndex1D"""
return _RMF_HDF5.StringsConstDataSet1D_get_size(self)
def get_value(self, ijk):
"""get_value(StringsConstDataSet1D self, DataSetIndex1D ijk) -> Strings"""
return _RMF_HDF5.StringsConstDataSet1D_get_value(self, ijk)
def __str__(self):
"""__str__(StringsConstDataSet1D self) -> std::string"""
return _RMF_HDF5.StringsConstDataSet1D___str__(self)
def __repr__(self):
"""__repr__(StringsConstDataSet1D self) -> std::string"""
return _RMF_HDF5.StringsConstDataSet1D___repr__(self)
def get_block(self, lb, size):
"""get_block(StringsConstDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size) -> StringsList"""
return _RMF_HDF5.StringsConstDataSet1D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(StringsConstDataSet1D self, StringsConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet1D___eq__(self, o)
def __ne__(self, o):
"""__ne__(StringsConstDataSet1D self, StringsConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet1D___ne__(self, o)
def __lt__(self, o):
"""__lt__(StringsConstDataSet1D self, StringsConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet1D___lt__(self, o)
def __gt__(self, o):
"""__gt__(StringsConstDataSet1D self, StringsConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet1D___gt__(self, o)
def __ge__(self, o):
"""__ge__(StringsConstDataSet1D self, StringsConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet1D___ge__(self, o)
def __le__(self, o):
"""__le__(StringsConstDataSet1D self, StringsConstDataSet1D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet1D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_StringsConstDataSet1D
__del__ = lambda self: None
StringsConstDataSet1D_swigregister = _RMF_HDF5.StringsConstDataSet1D_swigregister
StringsConstDataSet1D_swigregister(StringsConstDataSet1D)
class StringsConstDataSet2D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringsTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringsConstDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringsConstDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringsTraits,2)> self) -> StringsConstDataSet2D"""
this = _RMF_HDF5.new_StringsConstDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(StringsConstDataSet2D self) -> DataSetIndex2D"""
return _RMF_HDF5.StringsConstDataSet2D_get_size(self)
def get_value(self, ijk):
"""get_value(StringsConstDataSet2D self, DataSetIndex2D ijk) -> Strings"""
return _RMF_HDF5.StringsConstDataSet2D_get_value(self, ijk)
def __str__(self):
"""__str__(StringsConstDataSet2D self) -> std::string"""
return _RMF_HDF5.StringsConstDataSet2D___str__(self)
def __repr__(self):
"""__repr__(StringsConstDataSet2D self) -> std::string"""
return _RMF_HDF5.StringsConstDataSet2D___repr__(self)
def get_block(self, lb, size):
"""get_block(StringsConstDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size) -> StringsList"""
return _RMF_HDF5.StringsConstDataSet2D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(StringsConstDataSet2D self, StringsConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet2D___eq__(self, o)
def __ne__(self, o):
"""__ne__(StringsConstDataSet2D self, StringsConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet2D___ne__(self, o)
def __lt__(self, o):
"""__lt__(StringsConstDataSet2D self, StringsConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet2D___lt__(self, o)
def __gt__(self, o):
"""__gt__(StringsConstDataSet2D self, StringsConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet2D___gt__(self, o)
def __ge__(self, o):
"""__ge__(StringsConstDataSet2D self, StringsConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet2D___ge__(self, o)
def __le__(self, o):
"""__le__(StringsConstDataSet2D self, StringsConstDataSet2D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet2D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_StringsConstDataSet2D
__del__ = lambda self: None
StringsConstDataSet2D_swigregister = _RMF_HDF5.StringsConstDataSet2D_swigregister
StringsConstDataSet2D_swigregister(StringsConstDataSet2D)
class StringsConstDataSet3D(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringsTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringsConstDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringsConstDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringsTraits,3)> self) -> StringsConstDataSet3D"""
this = _RMF_HDF5.new_StringsConstDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_size(self):
"""get_size(StringsConstDataSet3D self) -> DataSetIndex3D"""
return _RMF_HDF5.StringsConstDataSet3D_get_size(self)
def get_value(self, ijk):
"""get_value(StringsConstDataSet3D self, DataSetIndex3D ijk) -> Strings"""
return _RMF_HDF5.StringsConstDataSet3D_get_value(self, ijk)
def __str__(self):
"""__str__(StringsConstDataSet3D self) -> std::string"""
return _RMF_HDF5.StringsConstDataSet3D___str__(self)
def __repr__(self):
"""__repr__(StringsConstDataSet3D self) -> std::string"""
return _RMF_HDF5.StringsConstDataSet3D___repr__(self)
def get_block(self, lb, size):
"""get_block(StringsConstDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size) -> StringsList"""
return _RMF_HDF5.StringsConstDataSet3D_get_block(self, lb, size)
def __eq__(self, o):
"""__eq__(StringsConstDataSet3D self, StringsConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet3D___eq__(self, o)
def __ne__(self, o):
"""__ne__(StringsConstDataSet3D self, StringsConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet3D___ne__(self, o)
def __lt__(self, o):
"""__lt__(StringsConstDataSet3D self, StringsConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet3D___lt__(self, o)
def __gt__(self, o):
"""__gt__(StringsConstDataSet3D self, StringsConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet3D___gt__(self, o)
def __ge__(self, o):
"""__ge__(StringsConstDataSet3D self, StringsConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet3D___ge__(self, o)
def __le__(self, o):
"""__le__(StringsConstDataSet3D self, StringsConstDataSet3D o) -> bool"""
return _RMF_HDF5.StringsConstDataSet3D___le__(self, o)
__swig_destroy__ = _RMF_HDF5.delete_StringsConstDataSet3D
__del__ = lambda self: None
StringsConstDataSet3D_swigregister = _RMF_HDF5.StringsConstDataSet3D_swigregister
StringsConstDataSet3D_swigregister(StringsConstDataSet3D)
class StringsDataSetAttributes1D(StringsConstDataSet1D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringsTraits,1)>)> class."""
__swig_setmethods__ = {}
for _s in [StringsConstDataSet1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringsDataSetAttributes1D, name, value)
__swig_getmethods__ = {}
for _s in [StringsConstDataSet1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringsDataSetAttributes1D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(StringsDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringsDataSetAttributes1D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(StringsDataSetAttributes1D self, std::string nm, Floats value)"""
return _RMF_HDF5.StringsDataSetAttributes1D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(StringsDataSetAttributes1D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringsDataSetAttributes1D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(StringsDataSetAttributes1D self, std::string nm, std::string value)"""
return _RMF_HDF5.StringsDataSetAttributes1D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_StringsDataSetAttributes1D
__del__ = lambda self: None
StringsDataSetAttributes1D_swigregister = _RMF_HDF5.StringsDataSetAttributes1D_swigregister
StringsDataSetAttributes1D_swigregister(StringsDataSetAttributes1D)
class StringsDataSetAttributes2D(StringsConstDataSet2D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringsTraits,2)>)> class."""
__swig_setmethods__ = {}
for _s in [StringsConstDataSet2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringsDataSetAttributes2D, name, value)
__swig_getmethods__ = {}
for _s in [StringsConstDataSet2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringsDataSetAttributes2D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(StringsDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringsDataSetAttributes2D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(StringsDataSetAttributes2D self, std::string nm, Floats value)"""
return _RMF_HDF5.StringsDataSetAttributes2D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(StringsDataSetAttributes2D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringsDataSetAttributes2D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(StringsDataSetAttributes2D self, std::string nm, std::string value)"""
return _RMF_HDF5.StringsDataSetAttributes2D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_StringsDataSetAttributes2D
__del__ = lambda self: None
StringsDataSetAttributes2D_swigregister = _RMF_HDF5.StringsDataSetAttributes2D_swigregister
StringsDataSetAttributes2D_swigregister(StringsDataSetAttributes2D)
class StringsDataSetAttributes3D(StringsConstDataSet3D):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstDataSetD<(RMF::HDF5::StringsTraits,3)>)> class."""
__swig_setmethods__ = {}
for _s in [StringsConstDataSet3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringsDataSetAttributes3D, name, value)
__swig_getmethods__ = {}
for _s in [StringsConstDataSet3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringsDataSetAttributes3D, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(StringsDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringsDataSetAttributes3D_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(StringsDataSetAttributes3D self, std::string nm, Floats value)"""
return _RMF_HDF5.StringsDataSetAttributes3D_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(StringsDataSetAttributes3D self, std::string nm, Ints value)"""
return _RMF_HDF5.StringsDataSetAttributes3D_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(StringsDataSetAttributes3D self, std::string nm, std::string value)"""
return _RMF_HDF5.StringsDataSetAttributes3D_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete_StringsDataSetAttributes3D
__del__ = lambda self: None
StringsDataSetAttributes3D_swigregister = _RMF_HDF5.StringsDataSetAttributes3D_swigregister
StringsDataSetAttributes3D_swigregister(StringsDataSetAttributes3D)
class IntDataSet1D(IntDataSetAttributes1D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IntTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [IntDataSetAttributes1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [IntDataSetAttributes1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IntTraits,1)> self) -> IntDataSet1D"""
this = _RMF_HDF5.new_IntDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IntDataSet1D self, DataSetIndex1D ijk, RMF::HDF5::IntTraits::Type value)"""
return _RMF_HDF5.IntDataSet1D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IntDataSet1D self) -> std::string"""
return _RMF_HDF5.IntDataSet1D___str__(self)
def __repr__(self):
"""__repr__(IntDataSet1D self) -> std::string"""
return _RMF_HDF5.IntDataSet1D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IntDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size, Ints value)"""
return _RMF_HDF5.IntDataSet1D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IntDataSet1D self, DataSetIndex1D ijk)"""
return _RMF_HDF5.IntDataSet1D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IntDataSet1D
__del__ = lambda self: None
IntDataSet1D_swigregister = _RMF_HDF5.IntDataSet1D_swigregister
IntDataSet1D_swigregister(IntDataSet1D)
class IntDataSet2D(IntDataSetAttributes2D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IntTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [IntDataSetAttributes2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [IntDataSetAttributes2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IntTraits,2)> self) -> IntDataSet2D"""
this = _RMF_HDF5.new_IntDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IntDataSet2D self, DataSetIndex2D ijk, RMF::HDF5::IntTraits::Type value)"""
return _RMF_HDF5.IntDataSet2D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IntDataSet2D self) -> std::string"""
return _RMF_HDF5.IntDataSet2D___str__(self)
def __repr__(self):
"""__repr__(IntDataSet2D self) -> std::string"""
return _RMF_HDF5.IntDataSet2D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IntDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size, Ints value)"""
return _RMF_HDF5.IntDataSet2D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IntDataSet2D self, DataSetIndex2D ijk)"""
return _RMF_HDF5.IntDataSet2D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IntDataSet2D
__del__ = lambda self: None
IntDataSet2D_swigregister = _RMF_HDF5.IntDataSet2D_swigregister
IntDataSet2D_swigregister(IntDataSet2D)
class IntDataSet3D(IntDataSetAttributes3D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IntTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [IntDataSetAttributes3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [IntDataSetAttributes3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IntTraits,3)> self) -> IntDataSet3D"""
this = _RMF_HDF5.new_IntDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IntDataSet3D self, DataSetIndex3D ijk, RMF::HDF5::IntTraits::Type value)"""
return _RMF_HDF5.IntDataSet3D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IntDataSet3D self) -> std::string"""
return _RMF_HDF5.IntDataSet3D___str__(self)
def __repr__(self):
"""__repr__(IntDataSet3D self) -> std::string"""
return _RMF_HDF5.IntDataSet3D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IntDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size, Ints value)"""
return _RMF_HDF5.IntDataSet3D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IntDataSet3D self, DataSetIndex3D ijk)"""
return _RMF_HDF5.IntDataSet3D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IntDataSet3D
__del__ = lambda self: None
IntDataSet3D_swigregister = _RMF_HDF5.IntDataSet3D_swigregister
IntDataSet3D_swigregister(IntDataSet3D)
class IntsDataSet1D(IntsDataSetAttributes1D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IntsTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [IntsDataSetAttributes1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntsDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [IntsDataSetAttributes1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntsDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IntsTraits,1)> self) -> IntsDataSet1D"""
this = _RMF_HDF5.new_IntsDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IntsDataSet1D self, DataSetIndex1D ijk, Ints value)"""
return _RMF_HDF5.IntsDataSet1D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IntsDataSet1D self) -> std::string"""
return _RMF_HDF5.IntsDataSet1D___str__(self)
def __repr__(self):
"""__repr__(IntsDataSet1D self) -> std::string"""
return _RMF_HDF5.IntsDataSet1D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IntsDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size, IntsList value)"""
return _RMF_HDF5.IntsDataSet1D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IntsDataSet1D self, DataSetIndex1D ijk)"""
return _RMF_HDF5.IntsDataSet1D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IntsDataSet1D
__del__ = lambda self: None
IntsDataSet1D_swigregister = _RMF_HDF5.IntsDataSet1D_swigregister
IntsDataSet1D_swigregister(IntsDataSet1D)
class IntsDataSet2D(IntsDataSetAttributes2D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IntsTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [IntsDataSetAttributes2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntsDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [IntsDataSetAttributes2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntsDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IntsTraits,2)> self) -> IntsDataSet2D"""
this = _RMF_HDF5.new_IntsDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IntsDataSet2D self, DataSetIndex2D ijk, Ints value)"""
return _RMF_HDF5.IntsDataSet2D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IntsDataSet2D self) -> std::string"""
return _RMF_HDF5.IntsDataSet2D___str__(self)
def __repr__(self):
"""__repr__(IntsDataSet2D self) -> std::string"""
return _RMF_HDF5.IntsDataSet2D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IntsDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size, IntsList value)"""
return _RMF_HDF5.IntsDataSet2D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IntsDataSet2D self, DataSetIndex2D ijk)"""
return _RMF_HDF5.IntsDataSet2D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IntsDataSet2D
__del__ = lambda self: None
IntsDataSet2D_swigregister = _RMF_HDF5.IntsDataSet2D_swigregister
IntsDataSet2D_swigregister(IntsDataSet2D)
class IntsDataSet3D(IntsDataSetAttributes3D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IntsTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [IntsDataSetAttributes3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IntsDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [IntsDataSetAttributes3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IntsDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IntsTraits,3)> self) -> IntsDataSet3D"""
this = _RMF_HDF5.new_IntsDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IntsDataSet3D self, DataSetIndex3D ijk, Ints value)"""
return _RMF_HDF5.IntsDataSet3D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IntsDataSet3D self) -> std::string"""
return _RMF_HDF5.IntsDataSet3D___str__(self)
def __repr__(self):
"""__repr__(IntsDataSet3D self) -> std::string"""
return _RMF_HDF5.IntsDataSet3D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IntsDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size, IntsList value)"""
return _RMF_HDF5.IntsDataSet3D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IntsDataSet3D self, DataSetIndex3D ijk)"""
return _RMF_HDF5.IntsDataSet3D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IntsDataSet3D
__del__ = lambda self: None
IntsDataSet3D_swigregister = _RMF_HDF5.IntsDataSet3D_swigregister
IntsDataSet3D_swigregister(IntsDataSet3D)
class FloatDataSet1D(FloatDataSetAttributes1D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::FloatTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [FloatDataSetAttributes1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [FloatDataSetAttributes1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::FloatTraits,1)> self) -> FloatDataSet1D"""
this = _RMF_HDF5.new_FloatDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(FloatDataSet1D self, DataSetIndex1D ijk, RMF::HDF5::FloatTraits::Type value)"""
return _RMF_HDF5.FloatDataSet1D_set_value(self, ijk, value)
def __str__(self):
"""__str__(FloatDataSet1D self) -> std::string"""
return _RMF_HDF5.FloatDataSet1D___str__(self)
def __repr__(self):
"""__repr__(FloatDataSet1D self) -> std::string"""
return _RMF_HDF5.FloatDataSet1D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(FloatDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size, Floats value)"""
return _RMF_HDF5.FloatDataSet1D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(FloatDataSet1D self, DataSetIndex1D ijk)"""
return _RMF_HDF5.FloatDataSet1D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_FloatDataSet1D
__del__ = lambda self: None
FloatDataSet1D_swigregister = _RMF_HDF5.FloatDataSet1D_swigregister
FloatDataSet1D_swigregister(FloatDataSet1D)
class FloatDataSet2D(FloatDataSetAttributes2D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::FloatTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [FloatDataSetAttributes2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [FloatDataSetAttributes2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::FloatTraits,2)> self) -> FloatDataSet2D"""
this = _RMF_HDF5.new_FloatDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(FloatDataSet2D self, DataSetIndex2D ijk, RMF::HDF5::FloatTraits::Type value)"""
return _RMF_HDF5.FloatDataSet2D_set_value(self, ijk, value)
def __str__(self):
"""__str__(FloatDataSet2D self) -> std::string"""
return _RMF_HDF5.FloatDataSet2D___str__(self)
def __repr__(self):
"""__repr__(FloatDataSet2D self) -> std::string"""
return _RMF_HDF5.FloatDataSet2D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(FloatDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size, Floats value)"""
return _RMF_HDF5.FloatDataSet2D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(FloatDataSet2D self, DataSetIndex2D ijk)"""
return _RMF_HDF5.FloatDataSet2D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_FloatDataSet2D
__del__ = lambda self: None
FloatDataSet2D_swigregister = _RMF_HDF5.FloatDataSet2D_swigregister
FloatDataSet2D_swigregister(FloatDataSet2D)
class FloatDataSet3D(FloatDataSetAttributes3D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::FloatTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [FloatDataSetAttributes3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [FloatDataSetAttributes3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::FloatTraits,3)> self) -> FloatDataSet3D"""
this = _RMF_HDF5.new_FloatDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(FloatDataSet3D self, DataSetIndex3D ijk, RMF::HDF5::FloatTraits::Type value)"""
return _RMF_HDF5.FloatDataSet3D_set_value(self, ijk, value)
def __str__(self):
"""__str__(FloatDataSet3D self) -> std::string"""
return _RMF_HDF5.FloatDataSet3D___str__(self)
def __repr__(self):
"""__repr__(FloatDataSet3D self) -> std::string"""
return _RMF_HDF5.FloatDataSet3D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(FloatDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size, Floats value)"""
return _RMF_HDF5.FloatDataSet3D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(FloatDataSet3D self, DataSetIndex3D ijk)"""
return _RMF_HDF5.FloatDataSet3D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_FloatDataSet3D
__del__ = lambda self: None
FloatDataSet3D_swigregister = _RMF_HDF5.FloatDataSet3D_swigregister
FloatDataSet3D_swigregister(FloatDataSet3D)
class FloatsDataSet1D(FloatsDataSetAttributes1D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::FloatsTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [FloatsDataSetAttributes1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatsDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [FloatsDataSetAttributes1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatsDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::FloatsTraits,1)> self) -> FloatsDataSet1D"""
this = _RMF_HDF5.new_FloatsDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(FloatsDataSet1D self, DataSetIndex1D ijk, Floats value)"""
return _RMF_HDF5.FloatsDataSet1D_set_value(self, ijk, value)
def __str__(self):
"""__str__(FloatsDataSet1D self) -> std::string"""
return _RMF_HDF5.FloatsDataSet1D___str__(self)
def __repr__(self):
"""__repr__(FloatsDataSet1D self) -> std::string"""
return _RMF_HDF5.FloatsDataSet1D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(FloatsDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size, FloatsList value)"""
return _RMF_HDF5.FloatsDataSet1D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(FloatsDataSet1D self, DataSetIndex1D ijk)"""
return _RMF_HDF5.FloatsDataSet1D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_FloatsDataSet1D
__del__ = lambda self: None
FloatsDataSet1D_swigregister = _RMF_HDF5.FloatsDataSet1D_swigregister
FloatsDataSet1D_swigregister(FloatsDataSet1D)
class FloatsDataSet2D(FloatsDataSetAttributes2D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::FloatsTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [FloatsDataSetAttributes2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatsDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [FloatsDataSetAttributes2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatsDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::FloatsTraits,2)> self) -> FloatsDataSet2D"""
this = _RMF_HDF5.new_FloatsDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(FloatsDataSet2D self, DataSetIndex2D ijk, Floats value)"""
return _RMF_HDF5.FloatsDataSet2D_set_value(self, ijk, value)
def __str__(self):
"""__str__(FloatsDataSet2D self) -> std::string"""
return _RMF_HDF5.FloatsDataSet2D___str__(self)
def __repr__(self):
"""__repr__(FloatsDataSet2D self) -> std::string"""
return _RMF_HDF5.FloatsDataSet2D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(FloatsDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size, FloatsList value)"""
return _RMF_HDF5.FloatsDataSet2D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(FloatsDataSet2D self, DataSetIndex2D ijk)"""
return _RMF_HDF5.FloatsDataSet2D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_FloatsDataSet2D
__del__ = lambda self: None
FloatsDataSet2D_swigregister = _RMF_HDF5.FloatsDataSet2D_swigregister
FloatsDataSet2D_swigregister(FloatsDataSet2D)
class FloatsDataSet3D(FloatsDataSetAttributes3D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::FloatsTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [FloatsDataSetAttributes3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, FloatsDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [FloatsDataSetAttributes3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, FloatsDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::FloatsTraits,3)> self) -> FloatsDataSet3D"""
this = _RMF_HDF5.new_FloatsDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(FloatsDataSet3D self, DataSetIndex3D ijk, Floats value)"""
return _RMF_HDF5.FloatsDataSet3D_set_value(self, ijk, value)
def __str__(self):
"""__str__(FloatsDataSet3D self) -> std::string"""
return _RMF_HDF5.FloatsDataSet3D___str__(self)
def __repr__(self):
"""__repr__(FloatsDataSet3D self) -> std::string"""
return _RMF_HDF5.FloatsDataSet3D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(FloatsDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size, FloatsList value)"""
return _RMF_HDF5.FloatsDataSet3D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(FloatsDataSet3D self, DataSetIndex3D ijk)"""
return _RMF_HDF5.FloatsDataSet3D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_FloatsDataSet3D
__del__ = lambda self: None
FloatsDataSet3D_swigregister = _RMF_HDF5.FloatsDataSet3D_swigregister
FloatsDataSet3D_swigregister(FloatsDataSet3D)
class IndexDataSet1D(IndexDataSetAttributes1D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IndexTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [IndexDataSetAttributes1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [IndexDataSetAttributes1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IndexTraits,1)> self) -> IndexDataSet1D"""
this = _RMF_HDF5.new_IndexDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IndexDataSet1D self, DataSetIndex1D ijk, RMF::HDF5::IndexTraits::Type value)"""
return _RMF_HDF5.IndexDataSet1D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IndexDataSet1D self) -> std::string"""
return _RMF_HDF5.IndexDataSet1D___str__(self)
def __repr__(self):
"""__repr__(IndexDataSet1D self) -> std::string"""
return _RMF_HDF5.IndexDataSet1D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IndexDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size, Ints value)"""
return _RMF_HDF5.IndexDataSet1D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IndexDataSet1D self, DataSetIndex1D ijk)"""
return _RMF_HDF5.IndexDataSet1D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IndexDataSet1D
__del__ = lambda self: None
IndexDataSet1D_swigregister = _RMF_HDF5.IndexDataSet1D_swigregister
IndexDataSet1D_swigregister(IndexDataSet1D)
class IndexDataSet2D(IndexDataSetAttributes2D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IndexTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [IndexDataSetAttributes2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [IndexDataSetAttributes2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IndexTraits,2)> self) -> IndexDataSet2D"""
this = _RMF_HDF5.new_IndexDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IndexDataSet2D self, DataSetIndex2D ijk, RMF::HDF5::IndexTraits::Type value)"""
return _RMF_HDF5.IndexDataSet2D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IndexDataSet2D self) -> std::string"""
return _RMF_HDF5.IndexDataSet2D___str__(self)
def __repr__(self):
"""__repr__(IndexDataSet2D self) -> std::string"""
return _RMF_HDF5.IndexDataSet2D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IndexDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size, Ints value)"""
return _RMF_HDF5.IndexDataSet2D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IndexDataSet2D self, DataSetIndex2D ijk)"""
return _RMF_HDF5.IndexDataSet2D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IndexDataSet2D
__del__ = lambda self: None
IndexDataSet2D_swigregister = _RMF_HDF5.IndexDataSet2D_swigregister
IndexDataSet2D_swigregister(IndexDataSet2D)
class IndexDataSet3D(IndexDataSetAttributes3D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IndexTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [IndexDataSetAttributes3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [IndexDataSetAttributes3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IndexTraits,3)> self) -> IndexDataSet3D"""
this = _RMF_HDF5.new_IndexDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IndexDataSet3D self, DataSetIndex3D ijk, RMF::HDF5::IndexTraits::Type value)"""
return _RMF_HDF5.IndexDataSet3D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IndexDataSet3D self) -> std::string"""
return _RMF_HDF5.IndexDataSet3D___str__(self)
def __repr__(self):
"""__repr__(IndexDataSet3D self) -> std::string"""
return _RMF_HDF5.IndexDataSet3D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IndexDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size, Ints value)"""
return _RMF_HDF5.IndexDataSet3D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IndexDataSet3D self, DataSetIndex3D ijk)"""
return _RMF_HDF5.IndexDataSet3D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IndexDataSet3D
__del__ = lambda self: None
IndexDataSet3D_swigregister = _RMF_HDF5.IndexDataSet3D_swigregister
IndexDataSet3D_swigregister(IndexDataSet3D)
class IndexesDataSet1D(IndexesDataSetAttributes1D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IndexesTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [IndexesDataSetAttributes1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexesDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [IndexesDataSetAttributes1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexesDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IndexesTraits,1)> self) -> IndexesDataSet1D"""
this = _RMF_HDF5.new_IndexesDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IndexesDataSet1D self, DataSetIndex1D ijk, Ints value)"""
return _RMF_HDF5.IndexesDataSet1D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IndexesDataSet1D self) -> std::string"""
return _RMF_HDF5.IndexesDataSet1D___str__(self)
def __repr__(self):
"""__repr__(IndexesDataSet1D self) -> std::string"""
return _RMF_HDF5.IndexesDataSet1D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IndexesDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size, IntsList value)"""
return _RMF_HDF5.IndexesDataSet1D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IndexesDataSet1D self, DataSetIndex1D ijk)"""
return _RMF_HDF5.IndexesDataSet1D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IndexesDataSet1D
__del__ = lambda self: None
IndexesDataSet1D_swigregister = _RMF_HDF5.IndexesDataSet1D_swigregister
IndexesDataSet1D_swigregister(IndexesDataSet1D)
class IndexesDataSet2D(IndexesDataSetAttributes2D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IndexesTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [IndexesDataSetAttributes2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexesDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [IndexesDataSetAttributes2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexesDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IndexesTraits,2)> self) -> IndexesDataSet2D"""
this = _RMF_HDF5.new_IndexesDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IndexesDataSet2D self, DataSetIndex2D ijk, Ints value)"""
return _RMF_HDF5.IndexesDataSet2D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IndexesDataSet2D self) -> std::string"""
return _RMF_HDF5.IndexesDataSet2D___str__(self)
def __repr__(self):
"""__repr__(IndexesDataSet2D self) -> std::string"""
return _RMF_HDF5.IndexesDataSet2D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IndexesDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size, IntsList value)"""
return _RMF_HDF5.IndexesDataSet2D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IndexesDataSet2D self, DataSetIndex2D ijk)"""
return _RMF_HDF5.IndexesDataSet2D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IndexesDataSet2D
__del__ = lambda self: None
IndexesDataSet2D_swigregister = _RMF_HDF5.IndexesDataSet2D_swigregister
IndexesDataSet2D_swigregister(IndexesDataSet2D)
class IndexesDataSet3D(IndexesDataSetAttributes3D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::IndexesTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [IndexesDataSetAttributes3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, IndexesDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [IndexesDataSetAttributes3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, IndexesDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::IndexesTraits,3)> self) -> IndexesDataSet3D"""
this = _RMF_HDF5.new_IndexesDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(IndexesDataSet3D self, DataSetIndex3D ijk, Ints value)"""
return _RMF_HDF5.IndexesDataSet3D_set_value(self, ijk, value)
def __str__(self):
"""__str__(IndexesDataSet3D self) -> std::string"""
return _RMF_HDF5.IndexesDataSet3D___str__(self)
def __repr__(self):
"""__repr__(IndexesDataSet3D self) -> std::string"""
return _RMF_HDF5.IndexesDataSet3D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(IndexesDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size, IntsList value)"""
return _RMF_HDF5.IndexesDataSet3D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(IndexesDataSet3D self, DataSetIndex3D ijk)"""
return _RMF_HDF5.IndexesDataSet3D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_IndexesDataSet3D
__del__ = lambda self: None
IndexesDataSet3D_swigregister = _RMF_HDF5.IndexesDataSet3D_swigregister
IndexesDataSet3D_swigregister(IndexesDataSet3D)
class StringDataSet1D(StringDataSetAttributes1D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::StringTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [StringDataSetAttributes1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [StringDataSetAttributes1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::StringTraits,1)> self) -> StringDataSet1D"""
this = _RMF_HDF5.new_StringDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(StringDataSet1D self, DataSetIndex1D ijk, RMF::HDF5::StringTraits::Type value)"""
return _RMF_HDF5.StringDataSet1D_set_value(self, ijk, value)
def __str__(self):
"""__str__(StringDataSet1D self) -> std::string"""
return _RMF_HDF5.StringDataSet1D___str__(self)
def __repr__(self):
"""__repr__(StringDataSet1D self) -> std::string"""
return _RMF_HDF5.StringDataSet1D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(StringDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size, Strings value)"""
return _RMF_HDF5.StringDataSet1D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(StringDataSet1D self, DataSetIndex1D ijk)"""
return _RMF_HDF5.StringDataSet1D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_StringDataSet1D
__del__ = lambda self: None
StringDataSet1D_swigregister = _RMF_HDF5.StringDataSet1D_swigregister
StringDataSet1D_swigregister(StringDataSet1D)
class StringDataSet2D(StringDataSetAttributes2D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::StringTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [StringDataSetAttributes2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [StringDataSetAttributes2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::StringTraits,2)> self) -> StringDataSet2D"""
this = _RMF_HDF5.new_StringDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(StringDataSet2D self, DataSetIndex2D ijk, RMF::HDF5::StringTraits::Type value)"""
return _RMF_HDF5.StringDataSet2D_set_value(self, ijk, value)
def __str__(self):
"""__str__(StringDataSet2D self) -> std::string"""
return _RMF_HDF5.StringDataSet2D___str__(self)
def __repr__(self):
"""__repr__(StringDataSet2D self) -> std::string"""
return _RMF_HDF5.StringDataSet2D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(StringDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size, Strings value)"""
return _RMF_HDF5.StringDataSet2D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(StringDataSet2D self, DataSetIndex2D ijk)"""
return _RMF_HDF5.StringDataSet2D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_StringDataSet2D
__del__ = lambda self: None
StringDataSet2D_swigregister = _RMF_HDF5.StringDataSet2D_swigregister
StringDataSet2D_swigregister(StringDataSet2D)
class StringDataSet3D(StringDataSetAttributes3D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::StringTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [StringDataSetAttributes3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [StringDataSetAttributes3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::StringTraits,3)> self) -> StringDataSet3D"""
this = _RMF_HDF5.new_StringDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(StringDataSet3D self, DataSetIndex3D ijk, RMF::HDF5::StringTraits::Type value)"""
return _RMF_HDF5.StringDataSet3D_set_value(self, ijk, value)
def __str__(self):
"""__str__(StringDataSet3D self) -> std::string"""
return _RMF_HDF5.StringDataSet3D___str__(self)
def __repr__(self):
"""__repr__(StringDataSet3D self) -> std::string"""
return _RMF_HDF5.StringDataSet3D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(StringDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size, Strings value)"""
return _RMF_HDF5.StringDataSet3D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(StringDataSet3D self, DataSetIndex3D ijk)"""
return _RMF_HDF5.StringDataSet3D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_StringDataSet3D
__del__ = lambda self: None
StringDataSet3D_swigregister = _RMF_HDF5.StringDataSet3D_swigregister
StringDataSet3D_swigregister(StringDataSet3D)
class StringsDataSet1D(StringsDataSetAttributes1D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::StringsTraits,1)> class."""
__swig_setmethods__ = {}
for _s in [StringsDataSetAttributes1D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringsDataSet1D, name, value)
__swig_getmethods__ = {}
for _s in [StringsDataSetAttributes1D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringsDataSet1D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::StringsTraits,1)> self) -> StringsDataSet1D"""
this = _RMF_HDF5.new_StringsDataSet1D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(StringsDataSet1D self, DataSetIndex1D ijk, Strings value)"""
return _RMF_HDF5.StringsDataSet1D_set_value(self, ijk, value)
def __str__(self):
"""__str__(StringsDataSet1D self) -> std::string"""
return _RMF_HDF5.StringsDataSet1D___str__(self)
def __repr__(self):
"""__repr__(StringsDataSet1D self) -> std::string"""
return _RMF_HDF5.StringsDataSet1D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(StringsDataSet1D self, DataSetIndex1D lb, DataSetIndex1D size, StringsList value)"""
return _RMF_HDF5.StringsDataSet1D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(StringsDataSet1D self, DataSetIndex1D ijk)"""
return _RMF_HDF5.StringsDataSet1D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_StringsDataSet1D
__del__ = lambda self: None
StringsDataSet1D_swigregister = _RMF_HDF5.StringsDataSet1D_swigregister
StringsDataSet1D_swigregister(StringsDataSet1D)
class StringsDataSet2D(StringsDataSetAttributes2D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::StringsTraits,2)> class."""
__swig_setmethods__ = {}
for _s in [StringsDataSetAttributes2D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringsDataSet2D, name, value)
__swig_getmethods__ = {}
for _s in [StringsDataSetAttributes2D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringsDataSet2D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::StringsTraits,2)> self) -> StringsDataSet2D"""
this = _RMF_HDF5.new_StringsDataSet2D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(StringsDataSet2D self, DataSetIndex2D ijk, Strings value)"""
return _RMF_HDF5.StringsDataSet2D_set_value(self, ijk, value)
def __str__(self):
"""__str__(StringsDataSet2D self) -> std::string"""
return _RMF_HDF5.StringsDataSet2D___str__(self)
def __repr__(self):
"""__repr__(StringsDataSet2D self) -> std::string"""
return _RMF_HDF5.StringsDataSet2D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(StringsDataSet2D self, DataSetIndex2D lb, DataSetIndex2D size, StringsList value)"""
return _RMF_HDF5.StringsDataSet2D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(StringsDataSet2D self, DataSetIndex2D ijk)"""
return _RMF_HDF5.StringsDataSet2D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_StringsDataSet2D
__del__ = lambda self: None
StringsDataSet2D_swigregister = _RMF_HDF5.StringsDataSet2D_swigregister
StringsDataSet2D_swigregister(StringsDataSet2D)
class StringsDataSet3D(StringsDataSetAttributes3D):
"""Proxy of C++ RMF::HDF5::DataSetD<(RMF::HDF5::StringsTraits,3)> class."""
__swig_setmethods__ = {}
for _s in [StringsDataSetAttributes3D]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, StringsDataSet3D, name, value)
__swig_getmethods__ = {}
for _s in [StringsDataSetAttributes3D]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, StringsDataSet3D, name)
def __init__(self):
"""__init__(RMF::HDF5::DataSetD<(RMF::HDF5::StringsTraits,3)> self) -> StringsDataSet3D"""
this = _RMF_HDF5.new_StringsDataSet3D()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def set_value(self, ijk, value):
"""set_value(StringsDataSet3D self, DataSetIndex3D ijk, Strings value)"""
return _RMF_HDF5.StringsDataSet3D_set_value(self, ijk, value)
def __str__(self):
"""__str__(StringsDataSet3D self) -> std::string"""
return _RMF_HDF5.StringsDataSet3D___str__(self)
def __repr__(self):
"""__repr__(StringsDataSet3D self) -> std::string"""
return _RMF_HDF5.StringsDataSet3D___repr__(self)
def set_block(self, lb, size, value):
"""set_block(StringsDataSet3D self, DataSetIndex3D lb, DataSetIndex3D size, StringsList value)"""
return _RMF_HDF5.StringsDataSet3D_set_block(self, lb, size, value)
def set_size(self, ijk):
"""set_size(StringsDataSet3D self, DataSetIndex3D ijk)"""
return _RMF_HDF5.StringsDataSet3D_set_size(self, ijk)
__swig_destroy__ = _RMF_HDF5.delete_StringsDataSet3D
__del__ = lambda self: None
StringsDataSet3D_swigregister = _RMF_HDF5.StringsDataSet3D_swigregister
StringsDataSet3D_swigregister(StringsDataSet3D)
class ConstGroup(_ConstAttributesObject):
"""Proxy of C++ RMF::HDF5::ConstGroup class."""
__swig_setmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, ConstGroup, name, value)
__swig_getmethods__ = {}
for _s in [_ConstAttributesObject]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, ConstGroup, name)
def __str__(self):
"""__str__(ConstGroup self) -> std::string"""
return _RMF_HDF5.ConstGroup___str__(self)
def __repr__(self):
"""__repr__(ConstGroup self) -> std::string"""
return _RMF_HDF5.ConstGroup___repr__(self)
def __init__(self, *args):
"""
__init__(RMF::HDF5::ConstGroup self) -> ConstGroup
__init__(RMF::HDF5::ConstGroup self, ConstGroup parent, std::string name) -> ConstGroup
"""
this = _RMF_HDF5.new_ConstGroup(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_child_int_data_set_1d(self, *args):
"""
get_child_int_data_set_1d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntTraits,1 > props) -> IntConstDataSet1D
get_child_int_data_set_1d(ConstGroup self, std::string name) -> IntConstDataSet1D
"""
return _RMF_HDF5.ConstGroup_get_child_int_data_set_1d(self, *args)
def get_child_int_data_set_2d(self, *args):
"""
get_child_int_data_set_2d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntTraits,2 > props) -> IntConstDataSet2D
get_child_int_data_set_2d(ConstGroup self, std::string name) -> IntConstDataSet2D
"""
return _RMF_HDF5.ConstGroup_get_child_int_data_set_2d(self, *args)
def get_child_int_data_set_3d(self, *args):
"""
get_child_int_data_set_3d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntTraits,3 > props) -> IntConstDataSet3D
get_child_int_data_set_3d(ConstGroup self, std::string name) -> IntConstDataSet3D
"""
return _RMF_HDF5.ConstGroup_get_child_int_data_set_3d(self, *args)
def get_child_float_data_set_1d(self, *args):
"""
get_child_float_data_set_1d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatTraits,1 > props) -> FloatConstDataSet1D
get_child_float_data_set_1d(ConstGroup self, std::string name) -> FloatConstDataSet1D
"""
return _RMF_HDF5.ConstGroup_get_child_float_data_set_1d(self, *args)
def get_child_float_data_set_2d(self, *args):
"""
get_child_float_data_set_2d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatTraits,2 > props) -> FloatConstDataSet2D
get_child_float_data_set_2d(ConstGroup self, std::string name) -> FloatConstDataSet2D
"""
return _RMF_HDF5.ConstGroup_get_child_float_data_set_2d(self, *args)
def get_child_float_data_set_3d(self, *args):
"""
get_child_float_data_set_3d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatTraits,3 > props) -> FloatConstDataSet3D
get_child_float_data_set_3d(ConstGroup self, std::string name) -> FloatConstDataSet3D
"""
return _RMF_HDF5.ConstGroup_get_child_float_data_set_3d(self, *args)
def get_child_index_data_set_1d(self, *args):
"""
get_child_index_data_set_1d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexTraits,1 > props) -> IndexConstDataSet1D
get_child_index_data_set_1d(ConstGroup self, std::string name) -> IndexConstDataSet1D
"""
return _RMF_HDF5.ConstGroup_get_child_index_data_set_1d(self, *args)
def get_child_index_data_set_2d(self, *args):
"""
get_child_index_data_set_2d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexTraits,2 > props) -> IndexConstDataSet2D
get_child_index_data_set_2d(ConstGroup self, std::string name) -> IndexConstDataSet2D
"""
return _RMF_HDF5.ConstGroup_get_child_index_data_set_2d(self, *args)
def get_child_index_data_set_3d(self, *args):
"""
get_child_index_data_set_3d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexTraits,3 > props) -> IndexConstDataSet3D
get_child_index_data_set_3d(ConstGroup self, std::string name) -> IndexConstDataSet3D
"""
return _RMF_HDF5.ConstGroup_get_child_index_data_set_3d(self, *args)
def get_child_string_data_set_1d(self, *args):
"""
get_child_string_data_set_1d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringTraits,1 > props) -> StringConstDataSet1D
get_child_string_data_set_1d(ConstGroup self, std::string name) -> StringConstDataSet1D
"""
return _RMF_HDF5.ConstGroup_get_child_string_data_set_1d(self, *args)
def get_child_string_data_set_2d(self, *args):
"""
get_child_string_data_set_2d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringTraits,2 > props) -> StringConstDataSet2D
get_child_string_data_set_2d(ConstGroup self, std::string name) -> StringConstDataSet2D
"""
return _RMF_HDF5.ConstGroup_get_child_string_data_set_2d(self, *args)
def get_child_string_data_set_3d(self, *args):
"""
get_child_string_data_set_3d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringTraits,3 > props) -> StringConstDataSet3D
get_child_string_data_set_3d(ConstGroup self, std::string name) -> StringConstDataSet3D
"""
return _RMF_HDF5.ConstGroup_get_child_string_data_set_3d(self, *args)
def get_child_strings_data_set_1d(self, *args):
"""
get_child_strings_data_set_1d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringsTraits,1 > props) -> StringsConstDataSet1D
get_child_strings_data_set_1d(ConstGroup self, std::string name) -> StringsConstDataSet1D
"""
return _RMF_HDF5.ConstGroup_get_child_strings_data_set_1d(self, *args)
def get_child_strings_data_set_2d(self, *args):
"""
get_child_strings_data_set_2d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringsTraits,2 > props) -> StringsConstDataSet2D
get_child_strings_data_set_2d(ConstGroup self, std::string name) -> StringsConstDataSet2D
"""
return _RMF_HDF5.ConstGroup_get_child_strings_data_set_2d(self, *args)
def get_child_strings_data_set_3d(self, *args):
"""
get_child_strings_data_set_3d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringsTraits,3 > props) -> StringsConstDataSet3D
get_child_strings_data_set_3d(ConstGroup self, std::string name) -> StringsConstDataSet3D
"""
return _RMF_HDF5.ConstGroup_get_child_strings_data_set_3d(self, *args)
def get_child_floats_data_set_1d(self, *args):
"""
get_child_floats_data_set_1d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatsTraits,1 > props) -> FloatsConstDataSet1D
get_child_floats_data_set_1d(ConstGroup self, std::string name) -> FloatsConstDataSet1D
"""
return _RMF_HDF5.ConstGroup_get_child_floats_data_set_1d(self, *args)
def get_child_floats_data_set_2d(self, *args):
"""
get_child_floats_data_set_2d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatsTraits,2 > props) -> FloatsConstDataSet2D
get_child_floats_data_set_2d(ConstGroup self, std::string name) -> FloatsConstDataSet2D
"""
return _RMF_HDF5.ConstGroup_get_child_floats_data_set_2d(self, *args)
def get_child_floats_data_set_3d(self, *args):
"""
get_child_floats_data_set_3d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatsTraits,3 > props) -> FloatsConstDataSet3D
get_child_floats_data_set_3d(ConstGroup self, std::string name) -> FloatsConstDataSet3D
"""
return _RMF_HDF5.ConstGroup_get_child_floats_data_set_3d(self, *args)
def get_child_ints_data_set_1d(self, *args):
"""
get_child_ints_data_set_1d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntsTraits,1 > props) -> IntsConstDataSet1D
get_child_ints_data_set_1d(ConstGroup self, std::string name) -> IntsConstDataSet1D
"""
return _RMF_HDF5.ConstGroup_get_child_ints_data_set_1d(self, *args)
def get_child_ints_data_set_2d(self, *args):
"""
get_child_ints_data_set_2d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntsTraits,2 > props) -> IntsConstDataSet2D
get_child_ints_data_set_2d(ConstGroup self, std::string name) -> IntsConstDataSet2D
"""
return _RMF_HDF5.ConstGroup_get_child_ints_data_set_2d(self, *args)
def get_child_ints_data_set_3d(self, *args):
"""
get_child_ints_data_set_3d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntsTraits,3 > props) -> IntsConstDataSet3D
get_child_ints_data_set_3d(ConstGroup self, std::string name) -> IntsConstDataSet3D
"""
return _RMF_HDF5.ConstGroup_get_child_ints_data_set_3d(self, *args)
def get_child_indexes_data_set_1d(self, *args):
"""
get_child_indexes_data_set_1d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexesTraits,1 > props) -> IndexesConstDataSet1D
get_child_indexes_data_set_1d(ConstGroup self, std::string name) -> IndexesConstDataSet1D
"""
return _RMF_HDF5.ConstGroup_get_child_indexes_data_set_1d(self, *args)
def get_child_indexes_data_set_2d(self, *args):
"""
get_child_indexes_data_set_2d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexesTraits,2 > props) -> IndexesConstDataSet2D
get_child_indexes_data_set_2d(ConstGroup self, std::string name) -> IndexesConstDataSet2D
"""
return _RMF_HDF5.ConstGroup_get_child_indexes_data_set_2d(self, *args)
def get_child_indexes_data_set_3d(self, *args):
"""
get_child_indexes_data_set_3d(ConstGroup self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexesTraits,3 > props) -> IndexesConstDataSet3D
get_child_indexes_data_set_3d(ConstGroup self, std::string name) -> IndexesConstDataSet3D
"""
return _RMF_HDF5.ConstGroup_get_child_indexes_data_set_3d(self, *args)
def get_number_of_children(self):
"""get_number_of_children(ConstGroup self) -> unsigned int"""
return _RMF_HDF5.ConstGroup_get_number_of_children(self)
def get_child_name(self, i):
"""get_child_name(ConstGroup self, unsigned int i) -> std::string"""
return _RMF_HDF5.ConstGroup_get_child_name(self, i)
def get_has_child(self, name):
"""get_has_child(ConstGroup self, std::string name) -> bool"""
return _RMF_HDF5.ConstGroup_get_has_child(self, name)
def get_child_is_data_set(self, i):
"""get_child_is_data_set(ConstGroup self, unsigned int i) -> bool"""
return _RMF_HDF5.ConstGroup_get_child_is_data_set(self, i)
def get_child_group(self, *args):
"""
get_child_group(ConstGroup self, unsigned int i) -> ConstGroup
get_child_group(ConstGroup self, std::string name) -> ConstGroup
"""
return _RMF_HDF5.ConstGroup_get_child_group(self, *args)
def get_child_is_group(self, *args):
"""
get_child_is_group(ConstGroup self, unsigned int i) -> bool
get_child_is_group(ConstGroup self, std::string name) -> bool
"""
return _RMF_HDF5.ConstGroup_get_child_is_group(self, *args)
__swig_destroy__ = _RMF_HDF5.delete_ConstGroup
__del__ = lambda self: None
ConstGroup_swigregister = _RMF_HDF5.ConstGroup_swigregister
ConstGroup_swigregister(ConstGroup)
class _HDF5MutableAttributesGroup(ConstGroup):
"""Proxy of C++ RMF::HDF5::MutableAttributes<(RMF::HDF5::ConstGroup)> class."""
__swig_setmethods__ = {}
for _s in [ConstGroup]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, _HDF5MutableAttributesGroup, name, value)
__swig_getmethods__ = {}
for _s in [ConstGroup]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, _HDF5MutableAttributesGroup, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_int_attribute(self, nm, value):
"""set_int_attribute(_HDF5MutableAttributesGroup self, std::string nm, Ints value)"""
return _RMF_HDF5._HDF5MutableAttributesGroup_set_int_attribute(self, nm, value)
def set_float_attribute(self, nm, value):
"""set_float_attribute(_HDF5MutableAttributesGroup self, std::string nm, Floats value)"""
return _RMF_HDF5._HDF5MutableAttributesGroup_set_float_attribute(self, nm, value)
def set_index_attribute(self, nm, value):
"""set_index_attribute(_HDF5MutableAttributesGroup self, std::string nm, Ints value)"""
return _RMF_HDF5._HDF5MutableAttributesGroup_set_index_attribute(self, nm, value)
def set_char_attribute(self, nm, value):
"""set_char_attribute(_HDF5MutableAttributesGroup self, std::string nm, std::string value)"""
return _RMF_HDF5._HDF5MutableAttributesGroup_set_char_attribute(self, nm, value)
__swig_destroy__ = _RMF_HDF5.delete__HDF5MutableAttributesGroup
__del__ = lambda self: None
_HDF5MutableAttributesGroup_swigregister = _RMF_HDF5._HDF5MutableAttributesGroup_swigregister
_HDF5MutableAttributesGroup_swigregister(_HDF5MutableAttributesGroup)
class ConstFile(ConstGroup):
"""Proxy of C++ RMF::HDF5::ConstFile class."""
__swig_setmethods__ = {}
for _s in [ConstGroup]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, ConstFile, name, value)
__swig_getmethods__ = {}
for _s in [ConstGroup]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, ConstFile, name)
def __init__(self, *args):
"""
__init__(RMF::HDF5::ConstFile self, File f) -> ConstFile
__init__(RMF::HDF5::ConstFile self) -> ConstFile
"""
this = _RMF_HDF5.new_ConstFile(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __str__(self):
"""__str__(ConstFile self) -> std::string"""
return _RMF_HDF5.ConstFile___str__(self)
def __repr__(self):
"""__repr__(ConstFile self) -> std::string"""
return _RMF_HDF5.ConstFile___repr__(self)
def get_name(self):
"""get_name(ConstFile self) -> std::string"""
return _RMF_HDF5.ConstFile_get_name(self)
__swig_destroy__ = _RMF_HDF5.delete_ConstFile
__del__ = lambda self: None
ConstFile_swigregister = _RMF_HDF5.ConstFile_swigregister
ConstFile_swigregister(ConstFile)
def open_file_read_only(name):
"""open_file_read_only(std::string name) -> ConstFile"""
return _RMF_HDF5.open_file_read_only(name)
def get_number_of_open_handles(*args):
"""
get_number_of_open_handles(ConstFile f) -> int
get_number_of_open_handles() -> int
"""
return _RMF_HDF5.get_number_of_open_handles(*args)
def get_open_handle_names(*args):
"""
get_open_handle_names(ConstFile f) -> Strings
get_open_handle_names() -> Strings
"""
return _RMF_HDF5.get_open_handle_names(*args)
def set_show_errors(tf):
"""set_show_errors(bool tf)"""
return _RMF_HDF5.set_show_errors(tf)
class Group(_HDF5MutableAttributesGroup):
"""Proxy of C++ RMF::HDF5::Group class."""
__swig_setmethods__ = {}
for _s in [_HDF5MutableAttributesGroup]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, Group, name, value)
__swig_getmethods__ = {}
for _s in [_HDF5MutableAttributesGroup]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, Group, name)
def __str__(self):
"""__str__(Group self) -> std::string"""
return _RMF_HDF5.Group___str__(self)
def __repr__(self):
"""__repr__(Group self) -> std::string"""
return _RMF_HDF5.Group___repr__(self)
def __init__(self, *args):
"""
__init__(RMF::HDF5::Group self) -> Group
__init__(RMF::HDF5::Group self, Group parent, std::string name) -> Group
"""
this = _RMF_HDF5.new_Group(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def add_child_group(self, name):
"""add_child_group(Group self, std::string name) -> Group"""
return _RMF_HDF5.Group_add_child_group(self, name)
def get_child_int_data_set_1d(self, *args):
"""
get_child_int_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntTraits,1 > props) -> IntDataSet1D
get_child_int_data_set_1d(Group self, std::string name) -> IntDataSet1D
"""
return _RMF_HDF5.Group_get_child_int_data_set_1d(self, *args)
def add_child_int_data_set_1d(self, *args):
"""
add_child_int_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IntTraits,1 > props) -> IntDataSet1D
add_child_int_data_set_1d(Group self, std::string name) -> IntDataSet1D
"""
return _RMF_HDF5.Group_add_child_int_data_set_1d(self, *args)
def get_child_int_data_set_2d(self, *args):
"""
get_child_int_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntTraits,2 > props) -> IntDataSet2D
get_child_int_data_set_2d(Group self, std::string name) -> IntDataSet2D
"""
return _RMF_HDF5.Group_get_child_int_data_set_2d(self, *args)
def add_child_int_data_set_2d(self, *args):
"""
add_child_int_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IntTraits,2 > props) -> IntDataSet2D
add_child_int_data_set_2d(Group self, std::string name) -> IntDataSet2D
"""
return _RMF_HDF5.Group_add_child_int_data_set_2d(self, *args)
def get_child_int_data_set_3d(self, *args):
"""
get_child_int_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntTraits,3 > props) -> IntDataSet3D
get_child_int_data_set_3d(Group self, std::string name) -> IntDataSet3D
"""
return _RMF_HDF5.Group_get_child_int_data_set_3d(self, *args)
def add_child_int_data_set_3d(self, *args):
"""
add_child_int_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IntTraits,3 > props) -> IntDataSet3D
add_child_int_data_set_3d(Group self, std::string name) -> IntDataSet3D
"""
return _RMF_HDF5.Group_add_child_int_data_set_3d(self, *args)
def get_child_float_data_set_1d(self, *args):
"""
get_child_float_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatTraits,1 > props) -> FloatDataSet1D
get_child_float_data_set_1d(Group self, std::string name) -> FloatDataSet1D
"""
return _RMF_HDF5.Group_get_child_float_data_set_1d(self, *args)
def add_child_float_data_set_1d(self, *args):
"""
add_child_float_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::FloatTraits,1 > props) -> FloatDataSet1D
add_child_float_data_set_1d(Group self, std::string name) -> FloatDataSet1D
"""
return _RMF_HDF5.Group_add_child_float_data_set_1d(self, *args)
def get_child_float_data_set_2d(self, *args):
"""
get_child_float_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatTraits,2 > props) -> FloatDataSet2D
get_child_float_data_set_2d(Group self, std::string name) -> FloatDataSet2D
"""
return _RMF_HDF5.Group_get_child_float_data_set_2d(self, *args)
def add_child_float_data_set_2d(self, *args):
"""
add_child_float_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::FloatTraits,2 > props) -> FloatDataSet2D
add_child_float_data_set_2d(Group self, std::string name) -> FloatDataSet2D
"""
return _RMF_HDF5.Group_add_child_float_data_set_2d(self, *args)
def get_child_float_data_set_3d(self, *args):
"""
get_child_float_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatTraits,3 > props) -> FloatDataSet3D
get_child_float_data_set_3d(Group self, std::string name) -> FloatDataSet3D
"""
return _RMF_HDF5.Group_get_child_float_data_set_3d(self, *args)
def add_child_float_data_set_3d(self, *args):
"""
add_child_float_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::FloatTraits,3 > props) -> FloatDataSet3D
add_child_float_data_set_3d(Group self, std::string name) -> FloatDataSet3D
"""
return _RMF_HDF5.Group_add_child_float_data_set_3d(self, *args)
def get_child_index_data_set_1d(self, *args):
"""
get_child_index_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexTraits,1 > props) -> IndexDataSet1D
get_child_index_data_set_1d(Group self, std::string name) -> IndexDataSet1D
"""
return _RMF_HDF5.Group_get_child_index_data_set_1d(self, *args)
def add_child_index_data_set_1d(self, *args):
"""
add_child_index_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IndexTraits,1 > props) -> IndexDataSet1D
add_child_index_data_set_1d(Group self, std::string name) -> IndexDataSet1D
"""
return _RMF_HDF5.Group_add_child_index_data_set_1d(self, *args)
def get_child_index_data_set_2d(self, *args):
"""
get_child_index_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexTraits,2 > props) -> IndexDataSet2D
get_child_index_data_set_2d(Group self, std::string name) -> IndexDataSet2D
"""
return _RMF_HDF5.Group_get_child_index_data_set_2d(self, *args)
def add_child_index_data_set_2d(self, *args):
"""
add_child_index_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IndexTraits,2 > props) -> IndexDataSet2D
add_child_index_data_set_2d(Group self, std::string name) -> IndexDataSet2D
"""
return _RMF_HDF5.Group_add_child_index_data_set_2d(self, *args)
def get_child_index_data_set_3d(self, *args):
"""
get_child_index_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexTraits,3 > props) -> IndexDataSet3D
get_child_index_data_set_3d(Group self, std::string name) -> IndexDataSet3D
"""
return _RMF_HDF5.Group_get_child_index_data_set_3d(self, *args)
def add_child_index_data_set_3d(self, *args):
"""
add_child_index_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IndexTraits,3 > props) -> IndexDataSet3D
add_child_index_data_set_3d(Group self, std::string name) -> IndexDataSet3D
"""
return _RMF_HDF5.Group_add_child_index_data_set_3d(self, *args)
def get_child_string_data_set_1d(self, *args):
"""
get_child_string_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringTraits,1 > props) -> StringDataSet1D
get_child_string_data_set_1d(Group self, std::string name) -> StringDataSet1D
"""
return _RMF_HDF5.Group_get_child_string_data_set_1d(self, *args)
def add_child_string_data_set_1d(self, *args):
"""
add_child_string_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::StringTraits,1 > props) -> StringDataSet1D
add_child_string_data_set_1d(Group self, std::string name) -> StringDataSet1D
"""
return _RMF_HDF5.Group_add_child_string_data_set_1d(self, *args)
def get_child_string_data_set_2d(self, *args):
"""
get_child_string_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringTraits,2 > props) -> StringDataSet2D
get_child_string_data_set_2d(Group self, std::string name) -> StringDataSet2D
"""
return _RMF_HDF5.Group_get_child_string_data_set_2d(self, *args)
def add_child_string_data_set_2d(self, *args):
"""
add_child_string_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::StringTraits,2 > props) -> StringDataSet2D
add_child_string_data_set_2d(Group self, std::string name) -> StringDataSet2D
"""
return _RMF_HDF5.Group_add_child_string_data_set_2d(self, *args)
def get_child_string_data_set_3d(self, *args):
"""
get_child_string_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringTraits,3 > props) -> StringDataSet3D
get_child_string_data_set_3d(Group self, std::string name) -> StringDataSet3D
"""
return _RMF_HDF5.Group_get_child_string_data_set_3d(self, *args)
def add_child_string_data_set_3d(self, *args):
"""
add_child_string_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::StringTraits,3 > props) -> StringDataSet3D
add_child_string_data_set_3d(Group self, std::string name) -> StringDataSet3D
"""
return _RMF_HDF5.Group_add_child_string_data_set_3d(self, *args)
def get_child_strings_data_set_1d(self, *args):
"""
get_child_strings_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringsTraits,1 > props) -> StringsDataSet1D
get_child_strings_data_set_1d(Group self, std::string name) -> StringsDataSet1D
"""
return _RMF_HDF5.Group_get_child_strings_data_set_1d(self, *args)
def add_child_strings_data_set_1d(self, *args):
"""
add_child_strings_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::StringsTraits,1 > props) -> StringsDataSet1D
add_child_strings_data_set_1d(Group self, std::string name) -> StringsDataSet1D
"""
return _RMF_HDF5.Group_add_child_strings_data_set_1d(self, *args)
def get_child_strings_data_set_2d(self, *args):
"""
get_child_strings_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringsTraits,2 > props) -> StringsDataSet2D
get_child_strings_data_set_2d(Group self, std::string name) -> StringsDataSet2D
"""
return _RMF_HDF5.Group_get_child_strings_data_set_2d(self, *args)
def add_child_strings_data_set_2d(self, *args):
"""
add_child_strings_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::StringsTraits,2 > props) -> StringsDataSet2D
add_child_strings_data_set_2d(Group self, std::string name) -> StringsDataSet2D
"""
return _RMF_HDF5.Group_add_child_strings_data_set_2d(self, *args)
def get_child_strings_data_set_3d(self, *args):
"""
get_child_strings_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::StringsTraits,3 > props) -> StringsDataSet3D
get_child_strings_data_set_3d(Group self, std::string name) -> StringsDataSet3D
"""
return _RMF_HDF5.Group_get_child_strings_data_set_3d(self, *args)
def add_child_strings_data_set_3d(self, *args):
"""
add_child_strings_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::StringsTraits,3 > props) -> StringsDataSet3D
add_child_strings_data_set_3d(Group self, std::string name) -> StringsDataSet3D
"""
return _RMF_HDF5.Group_add_child_strings_data_set_3d(self, *args)
def get_child_floats_data_set_1d(self, *args):
"""
get_child_floats_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatsTraits,1 > props) -> FloatsDataSet1D
get_child_floats_data_set_1d(Group self, std::string name) -> FloatsDataSet1D
"""
return _RMF_HDF5.Group_get_child_floats_data_set_1d(self, *args)
def add_child_floats_data_set_1d(self, *args):
"""
add_child_floats_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::FloatsTraits,1 > props) -> FloatsDataSet1D
add_child_floats_data_set_1d(Group self, std::string name) -> FloatsDataSet1D
"""
return _RMF_HDF5.Group_add_child_floats_data_set_1d(self, *args)
def get_child_floats_data_set_2d(self, *args):
"""
get_child_floats_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatsTraits,2 > props) -> FloatsDataSet2D
get_child_floats_data_set_2d(Group self, std::string name) -> FloatsDataSet2D
"""
return _RMF_HDF5.Group_get_child_floats_data_set_2d(self, *args)
def add_child_floats_data_set_2d(self, *args):
"""
add_child_floats_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::FloatsTraits,2 > props) -> FloatsDataSet2D
add_child_floats_data_set_2d(Group self, std::string name) -> FloatsDataSet2D
"""
return _RMF_HDF5.Group_add_child_floats_data_set_2d(self, *args)
def get_child_floats_data_set_3d(self, *args):
"""
get_child_floats_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::FloatsTraits,3 > props) -> FloatsDataSet3D
get_child_floats_data_set_3d(Group self, std::string name) -> FloatsDataSet3D
"""
return _RMF_HDF5.Group_get_child_floats_data_set_3d(self, *args)
def add_child_floats_data_set_3d(self, *args):
"""
add_child_floats_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::FloatsTraits,3 > props) -> FloatsDataSet3D
add_child_floats_data_set_3d(Group self, std::string name) -> FloatsDataSet3D
"""
return _RMF_HDF5.Group_add_child_floats_data_set_3d(self, *args)
def get_child_ints_data_set_1d(self, *args):
"""
get_child_ints_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntsTraits,1 > props) -> IntsDataSet1D
get_child_ints_data_set_1d(Group self, std::string name) -> IntsDataSet1D
"""
return _RMF_HDF5.Group_get_child_ints_data_set_1d(self, *args)
def add_child_ints_data_set_1d(self, *args):
"""
add_child_ints_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IntsTraits,1 > props) -> IntsDataSet1D
add_child_ints_data_set_1d(Group self, std::string name) -> IntsDataSet1D
"""
return _RMF_HDF5.Group_add_child_ints_data_set_1d(self, *args)
def get_child_ints_data_set_2d(self, *args):
"""
get_child_ints_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntsTraits,2 > props) -> IntsDataSet2D
get_child_ints_data_set_2d(Group self, std::string name) -> IntsDataSet2D
"""
return _RMF_HDF5.Group_get_child_ints_data_set_2d(self, *args)
def add_child_ints_data_set_2d(self, *args):
"""
add_child_ints_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IntsTraits,2 > props) -> IntsDataSet2D
add_child_ints_data_set_2d(Group self, std::string name) -> IntsDataSet2D
"""
return _RMF_HDF5.Group_add_child_ints_data_set_2d(self, *args)
def get_child_ints_data_set_3d(self, *args):
"""
get_child_ints_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IntsTraits,3 > props) -> IntsDataSet3D
get_child_ints_data_set_3d(Group self, std::string name) -> IntsDataSet3D
"""
return _RMF_HDF5.Group_get_child_ints_data_set_3d(self, *args)
def add_child_ints_data_set_3d(self, *args):
"""
add_child_ints_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IntsTraits,3 > props) -> IntsDataSet3D
add_child_ints_data_set_3d(Group self, std::string name) -> IntsDataSet3D
"""
return _RMF_HDF5.Group_add_child_ints_data_set_3d(self, *args)
def get_child_indexes_data_set_1d(self, *args):
"""
get_child_indexes_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexesTraits,1 > props) -> IndexesDataSet1D
get_child_indexes_data_set_1d(Group self, std::string name) -> IndexesDataSet1D
"""
return _RMF_HDF5.Group_get_child_indexes_data_set_1d(self, *args)
def add_child_indexes_data_set_1d(self, *args):
"""
add_child_indexes_data_set_1d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IndexesTraits,1 > props) -> IndexesDataSet1D
add_child_indexes_data_set_1d(Group self, std::string name) -> IndexesDataSet1D
"""
return _RMF_HDF5.Group_add_child_indexes_data_set_1d(self, *args)
def get_child_indexes_data_set_2d(self, *args):
"""
get_child_indexes_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexesTraits,2 > props) -> IndexesDataSet2D
get_child_indexes_data_set_2d(Group self, std::string name) -> IndexesDataSet2D
"""
return _RMF_HDF5.Group_get_child_indexes_data_set_2d(self, *args)
def add_child_indexes_data_set_2d(self, *args):
"""
add_child_indexes_data_set_2d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IndexesTraits,2 > props) -> IndexesDataSet2D
add_child_indexes_data_set_2d(Group self, std::string name) -> IndexesDataSet2D
"""
return _RMF_HDF5.Group_add_child_indexes_data_set_2d(self, *args)
def get_child_indexes_data_set_3d(self, *args):
"""
get_child_indexes_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetAccessPropertiesD< RMF::HDF5::IndexesTraits,3 > props) -> IndexesDataSet3D
get_child_indexes_data_set_3d(Group self, std::string name) -> IndexesDataSet3D
"""
return _RMF_HDF5.Group_get_child_indexes_data_set_3d(self, *args)
def add_child_indexes_data_set_3d(self, *args):
"""
add_child_indexes_data_set_3d(Group self, std::string name, RMF::HDF5::DataSetCreationPropertiesD< RMF::HDF5::IndexesTraits,3 > props) -> IndexesDataSet3D
add_child_indexes_data_set_3d(Group self, std::string name) -> IndexesDataSet3D
"""
return _RMF_HDF5.Group_add_child_indexes_data_set_3d(self, *args)
def get_child_group(self, *args):
"""
get_child_group(Group self, unsigned int i) -> Group
get_child_group(Group self, std::string name) -> Group
"""
return _RMF_HDF5.Group_get_child_group(self, *args)
__swig_destroy__ = _RMF_HDF5.delete_Group
__del__ = lambda self: None
Group_swigregister = _RMF_HDF5.Group_swigregister
Group_swigregister(Group)
class File(Group):
"""Proxy of C++ RMF::HDF5::File class."""
__swig_setmethods__ = {}
for _s in [Group]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, File, name, value)
__swig_getmethods__ = {}
for _s in [Group]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, File, name)
def __str__(self):
"""__str__(File self) -> std::string"""
return _RMF_HDF5.File___str__(self)
def __repr__(self):
"""__repr__(File self) -> std::string"""
return _RMF_HDF5.File___repr__(self)
def __init__(self):
"""__init__(RMF::HDF5::File self) -> File"""
this = _RMF_HDF5.new_File()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def get_name(self):
"""get_name(File self) -> std::string"""
return _RMF_HDF5.File_get_name(self)
def flush(self):
"""flush(File self)"""
return _RMF_HDF5.File_flush(self)
__swig_destroy__ = _RMF_HDF5.delete_File
__del__ = lambda self: None
File_swigregister = _RMF_HDF5.File_swigregister
File_swigregister(File)
def create_file(name):
"""create_file(std::string name) -> File"""
return _RMF_HDF5.create_file(name)
def open_file(name):
"""open_file(std::string name) -> File"""
return _RMF_HDF5.open_file(name)
def open_file_read_only_returning_nonconst(name):
"""open_file_read_only_returning_nonconst(std::string name) -> File"""
return _RMF_HDF5.open_file_read_only_returning_nonconst(name)
# This file is compatible with both classic and new-style classes.
| 40.648273
| 204
| 0.687602
| 39,736
| 356,526
| 5.595656
| 0.010117
| 0.065923
| 0.066418
| 0.016132
| 0.835317
| 0.792452
| 0.731233
| 0.691692
| 0.607275
| 0.506429
| 0
| 0.01989
| 0.200973
| 356,526
| 8,770
| 205
| 40.652908
| 0.760628
| 0.307576
| 0
| 0.562191
| 1
| 0
| 0.018665
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.283565
| false
| 0.000449
| 0.004266
| 0.00247
| 0.760889
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 6
|
a76a4a0dadc7692a808b833e00c197559d120526
| 10,924
|
py
|
Python
|
tests/tools/wapiti/test_parser.py
|
owtf/ptp
|
b43e581d7646330810f526432c689c3d88995df9
|
[
"BSD-3-Clause"
] | 23
|
2015-03-22T09:18:35.000Z
|
2022-03-10T23:28:13.000Z
|
tests/tools/wapiti/test_parser.py
|
owtf/ptp
|
b43e581d7646330810f526432c689c3d88995df9
|
[
"BSD-3-Clause"
] | 22
|
2015-07-12T12:23:40.000Z
|
2017-02-26T12:39:48.000Z
|
tests/tools/wapiti/test_parser.py
|
owtf/ptp
|
b43e581d7646330810f526432c689c3d88995df9
|
[
"BSD-3-Clause"
] | 14
|
2015-06-03T19:16:22.000Z
|
2022-03-10T23:28:15.000Z
|
# -*- coding: UTF-8 -*-
import mock
import unittest
from lxml import etree
from hamcrest import assert_that, has_entry, has_item, has_items, is_not
from ptp.libptp.constants import UNKNOWN, INFO, LOW, MEDIUM, HIGH
from ptp.libptp.exceptions import NotSupportedVersionError
from ptp.tools.wapiti.parser import WapitiXMLParser, Wapiti221XMLParser
def lxml_etree_parse(string):
return etree.fromstring(string).getroottree()
class TestWapitiXMLParser(unittest.TestCase):
###
# WapitiXMLParser.is_mine
###
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_is_mine(self, mock_lxml_etree_parse):
from .wapiti_reports_2_3_0 import report_high
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[report_high]):
WapitiXMLParser.__format__ = ''
self.assertTrue(WapitiXMLParser.is_mine('foo', 'bar', first=True))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_is_not_mine(self, mock_lxml_etree_parse):
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=['foo.bar']):
WapitiXMLParser.__format__ = ''
self.assertFalse(WapitiXMLParser.is_mine('foo', 'bar', first=True))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_is_mine_no_version(self, mock_lxml_etree_parse):
from .wapiti_reports_2_3_0 import report_high
stripped_report = report_high.replace('"generatorVersion"', '"generatorINVALIDHEADER"')
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[stripped_report]):
WapitiXMLParser.__format__ = ''
self.assertFalse(WapitiXMLParser.is_mine('foo', 'bar', first=True))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_is_mine_version_not_supported(self, mock_lxml_etree_parse):
from .wapiti_reports_2_3_0 import report_high
stripped_report = report_high.replace('Wapiti 2.3.0', 'Wapiti VERSIONTHATWONTEVEREXIST')
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[stripped_report]):
WapitiXMLParser.__format__ = ''
self.assertFalse(WapitiXMLParser.is_mine('foo', 'bar', first=True))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_is_mine_invalid_tool_name(self, mock_lxml_etree_parse):
from .wapiti_reports_2_3_0 import report_high
stripped_report = report_high.replace('<info name="generatorName">wapiti</info>', '<info name="generatorName">INVALIDTOOLNAME</info>')
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[stripped_report]):
WapitiXMLParser.__format__ = ''
self.assertFalse(WapitiXMLParser.is_mine('foo', 'bar', first=True))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_is_mine_no_report_infos(self, mock_lxml_etree_parse):
from .wapiti_reports_2_3_0 import report_high
stripped_report = report_high.replace('report_infos', 'INFOSTHATWONTBEFOUND')
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[stripped_report]):
WapitiXMLParser.__format__ = ''
self.assertFalse(WapitiXMLParser.is_mine('foo', 'bar', first=True))
###
# WapitiXMLParser.parse_metadata
###
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_parse_metadata(self, mock_lxml_etree_parse):
from .wapiti_reports_2_3_0 import report_high
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[report_high]):
WapitiXMLParser.__format__ = ''
my_wapiti = WapitiXMLParser('foo', 'bar', first=True)
assert_that(my_wapiti.parse_metadata(), has_entry('generatorVersion', '2.3.0'))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_parse_metadata_version_not_supported(self, mock_lxml_etree_parse):
from .wapiti_reports_2_3_0 import report_high
stripped_report = report_high.replace('Wapiti 2.3.0', 'Wapiti VERSIONTHATWONTEVEREXIST')
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[stripped_report]):
WapitiXMLParser.__format__ = ''
my_wapiti = WapitiXMLParser('foo', 'bar', first=True)
with self.assertRaises(NotSupportedVersionError):
my_wapiti.parse_metadata()
###
# WapitiXMLParser.parse_report
###
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_parse_report(self, mock_lxml_etree_parse):
from .wapiti_reports_2_3_0 import report_high
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[report_high]):
WapitiXMLParser.__format__ = ''
my_wapiti = WapitiXMLParser()
report = my_wapiti.parse_report()
assert_that(report, has_items(*[{'ranking': HIGH, 'name': 'Cross Site Scripting', 'description': '\nCross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications which allow code injection by malicious web users into the web pages viewed by other users. Examples of such code include HTML code and client-side scripts. '}] * 1))
assert_that(report, is_not(has_item([{'ranking': LOW}])))
assert_that(report, is_not(has_item([{'ranking': UNKNOWN}])))
assert_that(report, is_not(has_item([{'ranking': INFO}])))
assert_that(report, is_not(has_item([{'ranking': MEDIUM}])))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_parse_report_no_vulns(self, mock_lxml_etree_parse):
from .wapiti_reports_2_3_0 import report_no_vulns
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[report_no_vulns]):
WapitiXMLParser.__format__ = ''
my_wapiti = WapitiXMLParser()
report = my_wapiti.parse_report()
self.assertTrue(report == [])
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti_xml_parse_report_invalid_no_vulns(self, mock_lxml_etree_parse):
from .wapiti_reports_2_3_0 import report_invalid_no_vulns
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[report_invalid_no_vulns]):
WapitiXMLParser.__format__ = ''
my_wapiti = WapitiXMLParser()
report = my_wapiti.parse_report()
self.assertTrue(report == [])
###
# Wapiti221XMLParser.is_mine
###
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti221_xml_is_mine(self, mock_lxml_etree_parse):
from .wapiti_reports_2_2_1 import report_high
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[report_high]):
Wapiti221XMLParser.__format__ = ''
self.assertTrue(Wapiti221XMLParser.is_mine('foo', 'bar', first=True))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti221_xml_is_not_mine(self, mock_lxml_etree_parse):
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=['foo.bar']):
Wapiti221XMLParser.__format__ = ''
self.assertFalse(Wapiti221XMLParser.is_mine('foo', 'bar', first=True))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti221_xml_is_mine_no_version(self, mock_lxml_etree_parse):
from .wapiti_reports_2_2_1 import report_high
stripped_report = report_high.replace('<generatedBy', '"generatorINVALIDHEADER"')
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[stripped_report]):
Wapiti221XMLParser.__format__ = ''
self.assertFalse(Wapiti221XMLParser.is_mine('foo', 'bar', first=True))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti221_xml_is_mine_version_not_supported(self, mock_lxml_etree_parse):
from .wapiti_reports_2_2_1 import report_high
stripped_report = report_high.replace('Wapiti 2.2.1', 'Wapiti VERSIONTHATWONTEVEREXIST')
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[stripped_report]):
Wapiti221XMLParser.__format__ = ''
self.assertFalse(Wapiti221XMLParser.is_mine('foo', 'bar', first=True))
###
# Wapiti221XMLParser.parse_metadata
###
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti221_xml_parse_metadata(self, mock_lxml_etree_parse):
from .wapiti_reports_2_2_1 import report_high
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[report_high]):
Wapiti221XMLParser.__format__ = ''
my_wapiti221 = Wapiti221XMLParser('foo', 'bar', first=True)
assert_that(my_wapiti221.parse_metadata(), has_entry('version', 'Wapiti 2.2.1'))
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti221_xml_parse_metadata_version_not_supported(self, mock_lxml_etree_parse):
from .wapiti_reports_2_2_1 import report_high
stripped_report = report_high.replace('Wapiti 2.2.1', 'Wapiti VERSIONTHATWONTEVEREXIST')
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[stripped_report]):
Wapiti221XMLParser.__format__ = ''
my_wapiti221 = Wapiti221XMLParser('foo', 'bar', first=True)
with self.assertRaises(NotSupportedVersionError):
my_wapiti221.parse_metadata()
###
# Wapiti221XMLParser.parse_report
###
@mock.patch('lxml.etree.parse', side_effect=lxml_etree_parse)
def test_parser_wapiti221_xml_parse_report(self, mock_lxml_etree_parse):
from .wapiti_reports_2_2_1 import report_high
with mock.patch('ptp.libptp.parser.AbstractParser._recursive_find', return_value=[report_high]):
Wapiti221XMLParser.__format__ = ''
my_wapiti221 = Wapiti221XMLParser()
report = my_wapiti221.parse_report()
assert_that(report, has_items(*[{'ranking': HIGH, 'name': 'Cross Site Scripting', 'description': '\nCross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications which allow code injection by malicious web users into the web pages viewed by other users. Examples of such code include HTML code and client-side scripts. '}] * 1))
| 58.731183
| 397
| 0.725009
| 1,351
| 10,924
| 5.46336
| 0.092524
| 0.067064
| 0.104322
| 0.043896
| 0.884704
| 0.884704
| 0.884704
| 0.881452
| 0.862485
| 0.834846
| 0
| 0.017832
| 0.168345
| 10,924
| 185
| 398
| 59.048649
| 0.794606
| 0.018125
| 0
| 0.661972
| 0
| 0.014085
| 0.21803
| 0.101573
| 0
| 0
| 0
| 0
| 0.161972
| 1
| 0.133803
| false
| 0
| 0.161972
| 0.007042
| 0.309859
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a78a08f7b70bcd7d25516db43c076a2d817e62ec
| 14,057
|
py
|
Python
|
smartsheet/discussions.py
|
Funtimes-Smarts/Python-import-Smart
|
ffb99887d03e31d10da553c9ee8c7be1238816fc
|
[
"Apache-2.0"
] | null | null | null |
smartsheet/discussions.py
|
Funtimes-Smarts/Python-import-Smart
|
ffb99887d03e31d10da553c9ee8c7be1238816fc
|
[
"Apache-2.0"
] | null | null | null |
smartsheet/discussions.py
|
Funtimes-Smarts/Python-import-Smart
|
ffb99887d03e31d10da553c9ee8c7be1238816fc
|
[
"Apache-2.0"
] | null | null | null |
# pylint: disable=C0111,R0902,R0913
# Smartsheet Python SDK.
#
# Copyright 2016 Smartsheet.com, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"): you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import absolute_import
import logging
import os.path
import six
from . import fresh_operation
class Discussions(object):
"""Class for handling Discussions operations."""
def __init__(self, smartsheet_obj):
"""Init Discussions with base Smartsheet object."""
self._base = smartsheet_obj
self._log = logging.getLogger(__name__)
def add_comment_to_discussion(self, sheet_id, discussion_id,
comment_obj=None):
"""Add a Comment to the specified Discussion
Args:
sheet_id (int): Sheet ID
discussion_id (int): Discussion ID
comment_obj (Comment): Comment object.
Returns:
Result
"""
_op = fresh_operation('add_comment_to_discussion')
_op['method'] = 'POST'
_op['path'] = '/sheets/' + str(sheet_id) + '/discussions/' + str(
discussion_id) + '/comments'
_op['json'] = comment_obj
# filter before we go
_op['json'].pre_request_filter = 'add_comment_to_discussion'
expected = ['Result', 'Comment']
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
# pylint: disable=invalid-name
def add_comment_to_discussion_with_attachment(self, sheet_id,
discussion_id, comment, _file=None):
"""Add a Comment with an Attachment to the specified Discussion
Args:
sheet_id (int): Sheet ID
discussion_id (int): Discussion ID
comment (file): Comment object.
_file (file): String or file stream object.
Returns:
Result
"""
if not all(val is not None for val in ['sheet_id', 'discussion_id',
'comment']):
raise ValueError(
('One or more required values '
'are missing from call to ' + __name__))
_op = fresh_operation('add_comment_to_discussion_with_attachment')
_op['method'] = 'POST'
_op['path'] = '/sheets/' + str(sheet_id) + '/discussions/' + str(
discussion_id) + '/comments'
_op['files'] = {}
comment.pre_request_filter = 'add_comment_to_discussion_with_attachment'
field_str = comment.to_json()
_op['files']['comment'] = (None, six.StringIO(field_str), 'application/json')
_op['files']['file'] = _file
expected = ['Result', 'Comment']
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
# pylint: enable=invalid-name
def create_discussion_on_row(self, sheet_id, row_id,
discussion_obj=None):
"""Create a new Discussion on a Row.
Args:
sheet_id (int): Sheet ID
row_id (int): Row ID
discussion_obj (Discussion): Discussion object.
Returns:
Result
"""
_op = fresh_operation('create_discussion_on_row')
_op['method'] = 'POST'
_op['path'] = '/sheets/' + str(sheet_id) + '/rows/' + str(
row_id) + '/discussions'
_op['json'] = discussion_obj
# filter before we go
_op['json'].pre_request_filter = 'create_discussion_on_row'
expected = ['Result', 'Discussion']
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
# pylint: disable=invalid-name
def create_discussion_on_row_with_attachment(self, sheet_id, row_id,
discussion, _file=None):
"""Create a new Discussion on a Row with an attachment.
Args:
sheet_id (int): Sheet ID
row_id (int): Row ID
discussion (file): Discussion object.
_file (file): String or file stream object.
Returns:
Result
"""
if not all(val is not None for val in ['sheet_id', 'row_id',
'discussion']):
raise ValueError(
('One or more required values '
'are missing from call to ' + __name__))
_op = fresh_operation('create_discussion_on_row_with_attachment')
_op['method'] = 'POST'
_op['path'] = '/sheets/' + str(sheet_id) + '/rows/' + str(
row_id) + '/discussions'
_op['files'] = {}
discussion.pre_request_filter = 'create_discussion_on_row_with_attachment'
field_str = discussion.to_json()
_op['files']['discussion'] = (None, six.StringIO(field_str), 'application/json')
_op['files']['file'] = _file
expected = ['Result', 'Discussion']
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
# pylint: enable=invalid-name
def create_discussion_on_sheet(self, sheet_id, discussion_obj=None):
"""Create a new Discussion on a Sheet.
Args:
sheet_id (int): Sheet ID
discussion_obj (Discussion): Discussion object.
Returns:
Result
"""
_op = fresh_operation('create_discussion_on_sheet')
_op['method'] = 'POST'
_op['path'] = '/sheets/' + str(sheet_id) + '/discussions'
_op['json'] = discussion_obj
# filter before we go
_op['json'].pre_request_filter = 'create_discussion_on_sheet'
expected = ['Result', 'Discussion']
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
# pylint: disable=invalid-name
def create_discussion_on_sheet_with_attachment(self, sheet_id,
discussion, _file=None):
"""Create a new Discussion on a Sheet with an attachment.
Args:
sheet_id (int): Sheet ID
discussion (file): Discussion object.
_file (file): String or file stream object.
Returns:
Result
"""
_op = fresh_operation('create_discussion_on_sheet_with_attachment')
_op['method'] = 'POST'
_op['path'] = '/sheets/' + str(sheet_id) + '/discussions'
_op['files'] = {}
discussion.pre_request_filter = 'create_discussion_on_sheet_with_attachment'
field_str = discussion.to_json()
_op['files']['discussion'] = (None, six.StringIO(field_str), 'application/json')
_op['files']['file'] = _file
expected = ['Result', 'Discussion']
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
# pylint: enable=invalid-name
def delete_discussion(self, sheet_id, discussion_id):
"""Delete the specified Discussion.
Args:
sheet_id (int): Sheet ID
discussion_id (int): Discussion ID
Returns:
Result
"""
_op = fresh_operation('delete_discussion')
_op['method'] = 'DELETE'
_op['path'] = '/sheets/' + str(sheet_id) + '/discussions/' + str(
discussion_id)
expected = 'Result'
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
def delete_discussion_comment(self, sheet_id, comment_id):
"""Delete the specified Sheet Comment.
Delete the specified Comment from the specified Sheet.
Args:
sheet_id (int): Sheet ID
comment_id (int): Comment ID
Returns:
Result
"""
_op = fresh_operation('delete_discussion_comment')
_op['method'] = 'DELETE'
_op['path'] = '/sheets/' + str(sheet_id) + '/comments/' + str(
comment_id)
expected = 'Result'
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
def get_all_discussions(self, sheet_id, include=None, page_size=100,
page=1, include_all=False):
"""Get a list of all Discussions on the specified Sheet.
Get a list of all Discussions associated with the specified
Sheet (both sheet-level discussions and row-level discussions).
Args:
sheet_id (int): Sheet ID
include (list[str]): A comma-separated list of
optional elements to include in the response. Valid list
values: comments, attachments
page_size (int): The maximum number of items to
return per page. Defaults to 100.
page (int): Which page to return. Defaults to 1
if not specified.
include_all (bool): If true, include all results
(i.e. do not paginate).
Returns:
IndexResult
"""
_op = fresh_operation('get_all_discussions')
_op['method'] = 'GET'
_op['path'] = '/sheets/' + str(sheet_id) + '/discussions'
_op['query_params']['include'] = include
_op['query_params']['pageSize'] = page_size
_op['query_params']['page'] = page
_op['query_params']['includeAll'] = include_all
expected = ['IndexResult', 'Discussion']
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
def get_discussion(self, sheet_id, discussion_id):
"""Get the specified Discussion.
Args:
sheet_id (int): Sheet ID
discussion_id (int): Discussion ID
Returns:
Discussion
"""
_op = fresh_operation('get_discussion')
_op['method'] = 'GET'
_op['path'] = '/sheets/' + str(sheet_id) + '/discussions/' + str(
discussion_id)
expected = 'Discussion'
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
def get_discussion_comment(self, sheet_id, comment_id):
"""Get the specified Comment.
Args:
sheet_id (int): Sheet ID
comment_id (int): Comment ID
Returns:
Comment
"""
_op = fresh_operation('get_discussion_comment')
_op['method'] = 'GET'
_op['path'] = '/sheets/' + str(sheet_id) + '/comments/' + str(
comment_id)
expected = 'Comment'
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
def get_row_discussions(self, sheet_id, row_id, include=None,
page_size=100, page=1, include_all=False):
"""Get a list of all Discussions associated with the specified Row.
Args:
sheet_id (int): Sheet ID
row_id (int): Row ID
include (list[str]): A comma-separated list of
optional elements to include in the response. Valid list
values: comments, attachments. (Attachments is effective
only if comments is present, otherwise ignored.)
page_size (int): The maximum number of items to
return per page. Defaults to 100.
page (int): Which page to return. Defaults to 1
if not specified.
include_all (bool): If true, include all results
(i.e. do not paginate).
Returns:
IndexResult
"""
_op = fresh_operation('get_row_discussions')
_op['method'] = 'GET'
_op['path'] = '/sheets/' + str(sheet_id) + '/rows/' + str(
row_id) + '/discussions'
_op['query_params']['include'] = include
_op['query_params']['pageSize'] = page_size
_op['query_params']['page'] = page
_op['query_params']['includeAll'] = include_all
expected = ['IndexResult', 'Discussion']
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
def update_comment(self, sheet_id, comment_id, comment_obj):
"""Update the specified Comment.
Args:
sheet_id (int): Sheet ID
comment_id (int): Comment ID
comment_obj (Comment): Comment object with the following attributes:
* text (required)
Returns:
Result
"""
_op = fresh_operation('update_comment')
_op['method'] = 'PUT'
_op['path'] = '/sheets/' + str(sheet_id) + '/comments/' + str(comment_id)
_op['json'] = comment_obj
# filter before we go
_op['json'].pre_request_filter = 'update_comment'
expected = ['Result', 'Comment']
prepped_request = self._base.prepare_request(_op)
response = self._base.request(prepped_request, expected, _op)
return response
| 34.453431
| 88
| 0.591663
| 1,557
| 14,057
| 5.06808
| 0.123956
| 0.047903
| 0.018122
| 0.023064
| 0.839818
| 0.822709
| 0.775567
| 0.742111
| 0.730833
| 0.719427
| 0
| 0.003684
| 0.30483
| 14,057
| 408
| 89
| 34.453431
| 0.803827
| 0.298001
| 0
| 0.664706
| 0
| 0
| 0.187268
| 0.049826
| 0
| 0
| 0
| 0
| 0
| 1
| 0.082353
| false
| 0
| 0.029412
| 0
| 0.194118
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
a7dca45e8c39042ead1502ecb2864b7e509590a9
| 217
|
py
|
Python
|
src/pydrs/bsmp/__init__.py
|
lnls-sirius/pydrs
|
4e44cf0272fcf0020139a6c176a708b4642a644a
|
[
"MIT"
] | null | null | null |
src/pydrs/bsmp/__init__.py
|
lnls-sirius/pydrs
|
4e44cf0272fcf0020139a6c176a708b4642a644a
|
[
"MIT"
] | 1
|
2022-01-14T14:59:09.000Z
|
2022-01-21T18:48:32.000Z
|
src/pydrs/bsmp/__init__.py
|
lnls-sirius/pydrs
|
4e44cf0272fcf0020139a6c176a708b4642a644a
|
[
"MIT"
] | 1
|
2022-01-14T14:54:14.000Z
|
2022-01-14T14:54:14.000Z
|
from .command import CommonPSBSMP
from .entities import EntitiesPS, Parameter, Parameters
from .interface import SerialInterface
__all__ = ["CommonPSBSMP", "SerialInterface", "EntitiesPS", "Parameter", "Parameters"]
| 36.166667
| 86
| 0.797235
| 20
| 217
| 8.45
| 0.55
| 0.224852
| 0.343195
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.101382
| 217
| 5
| 87
| 43.4
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0.258065
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.75
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
ac00fae6d3100df3adc8da00d4c54068e68d2ba2
| 6,662
|
py
|
Python
|
tests/test_elasticsearch.py
|
kohtoa15/zubbi
|
479d8d88e306915d93e8bf88a395a79ee88fffdc
|
[
"Apache-2.0"
] | 17
|
2018-11-09T11:56:50.000Z
|
2022-01-20T08:50:56.000Z
|
tests/test_elasticsearch.py
|
kohtoa15/zubbi
|
479d8d88e306915d93e8bf88a395a79ee88fffdc
|
[
"Apache-2.0"
] | 8
|
2019-02-26T00:39:14.000Z
|
2021-03-10T13:57:14.000Z
|
tests/test_elasticsearch.py
|
kohtoa15/zubbi
|
479d8d88e306915d93e8bf88a395a79ee88fffdc
|
[
"Apache-2.0"
] | 2
|
2019-02-26T09:03:56.000Z
|
2021-03-16T07:12:23.000Z
|
import ssl
from unittest import mock
import elasticsearch_dsl
import pytest
from elasticsearch_dsl.serializer import serializer
from zubbi.models import (
AnsibleRole,
GitRepo,
init_elasticsearch_con,
ZuulJob,
ZuulTenant,
)
@pytest.fixture(scope="function")
def elmock():
with mock.patch.object(elasticsearch_dsl.connections, "Elasticsearch") as _elmock:
yield _elmock
# Reset the name of each index to its original value as it might have changed
# during the tests. Btw, this clearly shows that this is a hack ;-)
for idx_cls in [ZuulJob, AnsibleRole, ZuulTenant, GitRepo]:
# As the Index.name attribute holds the constant value from the original
# definition, we can use it to reset the active value which might have
# changed due to the index_prefix hack.
idx_cls._index._name = idx_cls.Index.name
def test_elasticsearch_init_ssl_defaults(elmock):
tls_config = {"enabled": True}
init_elasticsearch_con("127.0.0.1", "user", "password", 443, tls=tls_config)
# Use single assertion for each argument as we can't compare the ssl_context so easily
kwargs = elmock.call_args[1]
assert kwargs["port"] == 443
assert kwargs["use_ssl"] is True
assert kwargs["ssl_context"].check_hostname is True
assert kwargs["ssl_context"].verify_mode == ssl.CERT_REQUIRED
def test_elasticsearch_init_ssl(elmock):
tls_config = {"enabled": True, "check_hostname": False, "verify_mode": "CERT_NONE"}
init_elasticsearch_con("127.0.0.1", "user", "password", 443, tls=tls_config)
kwargs = elmock.call_args[1]
assert kwargs["port"] == 443
assert kwargs["use_ssl"] is True
assert kwargs["ssl_context"].check_hostname is False
assert kwargs["ssl_context"].verify_mode == ssl.CERT_NONE
def test_elasticsearch_init(elmock):
# Define the existing indices for the mock
existing_indices = {"zuul-jobs", "ansible-roles", "unknown-index"}
elmock.return_value.indices.exists.side_effect = (
lambda index: index in existing_indices
)
init_elasticsearch_con("127.0.0.1", "user", "password")
# Validate that the Elasticsearch() (which is called by elasticsearch-dsl in the end)
# was called with the correct arguments.
assert elmock.call_args == mock.call(
host="127.0.0.1",
port=9200,
http_auth=("user", "password"),
use_ssl=False,
ssl_context=None,
serializer=serializer,
)
# Validate that all necessary indices were checked for existence
checked_indices = {
call[1]["index"] for call in elmock.return_value.indices.exists.call_args_list
}
assert {
"zuul-jobs",
"ansible-roles",
"zuul-tenants",
"git-repos",
} == checked_indices
# Validate that only the missing indices were created
created_indices = {
call[1]["index"] for call in elmock.return_value.indices.create.call_args_list
}
assert {"zuul-tenants", "git-repos"} == created_indices
def test_elasticsearch_init_with_prefix(elmock):
# Define the existing indices for the mock
existing_indices = {"zubbi-zuul-jobs", "zubbi-ansible-roles", "unknown-index"}
elmock.return_value.indices.exists.side_effect = (
lambda index: index in existing_indices
)
init_elasticsearch_con("127.0.0.1", "user", "password", index_prefix="zubbi")
# Validate that the Elasticsearch() (which is called by elasticsearch-dsl in the end)
# was called with the correct arguments.
assert elmock.call_args == mock.call(
host="127.0.0.1",
port=9200,
http_auth=("user", "password"),
use_ssl=False,
ssl_context=None,
serializer=serializer,
)
# Validate that all necessary indices were checked for existence
checked_indices = {
call[1]["index"] for call in elmock.return_value.indices.exists.call_args_list
}
assert {
"zubbi-zuul-jobs",
"zubbi-ansible-roles",
"zubbi-zuul-tenants",
"zubbi-git-repos",
} == checked_indices
# Validate that only the missing indices were created
created_indices = {
call[1]["index"] for call in elmock.return_value.indices.create.call_args_list
}
assert {"zubbi-zuul-tenants", "zubbi-git-repos"} == created_indices
def test_elasticsearch_init_with_empty_prefix(elmock):
# Define the existing indices for the mock
existing_indices = {"zuul-jobs", "ansible-roles", "unknown-index"}
elmock.return_value.indices.exists.side_effect = (
lambda index: index in existing_indices
)
init_elasticsearch_con("127.0.0.1", "user", "password", index_prefix="")
# Validate that all necessary indices were checked for existence
checked_indices = {
call[1]["index"] for call in elmock.return_value.indices.exists.call_args_list
}
assert {
"zuul-jobs",
"ansible-roles",
"zuul-tenants",
"git-repos",
} == checked_indices
# Validate that only the missing indices were created
created_indices = {
call[1]["index"] for call in elmock.return_value.indices.create.call_args_list
}
assert {"zuul-tenants", "git-repos"} == created_indices
def test_elasticsearch_init_with_prefix_multi(elmock):
# Define the existing indices for the mock
existing_indices = {"zubbi-zuul-jobs", "zubbi-ansible-roles", "unknown-index"}
elmock.return_value.indices.exists.side_effect = (
lambda index: index in existing_indices
)
init_elasticsearch_con("127.0.0.1", "user", "password", index_prefix="zubbi")
init_elasticsearch_con("127.0.0.1", "user", "password", index_prefix="zubbi")
# Evenv if we called the init() method multiple times, the index should only be
# prepended once.
checked_indices = {
call[1]["index"] for call in elmock.return_value.indices.exists.call_args_list
}
assert {
"zubbi-zuul-jobs",
"zubbi-ansible-roles",
"zubbi-zuul-tenants",
"zubbi-git-repos",
} == checked_indices
def test_elasticsearch_write(elmock):
init_elasticsearch_con("127.0.0.1", "user", "password")
zt = ZuulTenant(name="foo")
zt.save()
assert elmock.return_value.index.call_args == mock.call(
index="zuul-tenants", body=zt.to_dict()
)
def test_elasticsearch_write_with_prefix(elmock):
init_elasticsearch_con("127.0.0.1", "user", "password", index_prefix="zubbi")
zt = ZuulTenant(name="foo")
zt.save()
assert elmock.return_value.index.call_args == mock.call(
index="zubbi-zuul-tenants", body=zt.to_dict()
)
| 32.656863
| 90
| 0.680126
| 875
| 6,662
| 5.004571
| 0.176
| 0.02375
| 0.050468
| 0.015072
| 0.787166
| 0.76296
| 0.746746
| 0.746746
| 0.728934
| 0.717515
| 0
| 0.017996
| 0.207595
| 6,662
| 203
| 91
| 32.817734
| 0.811517
| 0.188082
| 0
| 0.627737
| 0
| 0
| 0.170071
| 0
| 0
| 0
| 0
| 0
| 0.138686
| 1
| 0.065693
| false
| 0.080292
| 0.043796
| 0
| 0.109489
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 6
|
ac10052d36898da2e1d7229b4f1e0db5ab5a942a
| 342
|
py
|
Python
|
Codewars/8kyu/nba-full-48-minutes-average/Python/test.py
|
RevansChen/online-judge
|
ad1b07fee7bd3c49418becccda904e17505f3018
|
[
"MIT"
] | 7
|
2017-09-20T16:40:39.000Z
|
2021-08-31T18:15:08.000Z
|
Codewars/8kyu/nba-full-48-minutes-average/Python/test.py
|
RevansChen/online-judge
|
ad1b07fee7bd3c49418becccda904e17505f3018
|
[
"MIT"
] | null | null | null |
Codewars/8kyu/nba-full-48-minutes-average/Python/test.py
|
RevansChen/online-judge
|
ad1b07fee7bd3c49418becccda904e17505f3018
|
[
"MIT"
] | null | null | null |
# Python - 2.7.6
test.assert_equals(nba_extrap(12, 20), 28.8)
test.assert_equals(nba_extrap(10, 10), 48.0)
test.assert_equals(nba_extrap(5, 17), 14.1)
test.assert_equals(nba_extrap(0, 0), 0)
test.assert_equals(nba_extrap(30.8, 34.7), 42.6) # Russell Westbrook 1/15/17
test.assert_equals(nba_extrap(22.9, 33.8), 32.5) # Kemba Walker 1/15/17
| 42.75
| 77
| 0.72807
| 71
| 342
| 3.338028
| 0.450704
| 0.253165
| 0.405063
| 0.481013
| 0.64135
| 0.219409
| 0
| 0
| 0
| 0
| 0
| 0.174194
| 0.093567
| 342
| 8
| 78
| 42.75
| 0.590323
| 0.178363
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
ac1a0f783b0f7ff748803fe5723c62d1e10dde19
| 34
|
py
|
Python
|
2019/## Python/Basico-MacBook-Ed/NaoEhHelloWorld3.py
|
ed1rac/AulasEstruturasDados
|
1a351abee539a2be5e73cba60a61c3225c80164b
|
[
"MIT"
] | 8
|
2016-05-06T01:07:21.000Z
|
2021-05-27T16:30:17.000Z
|
2019/## Python/Basico-MacBook-Ed/NaoEhHelloWorld3.py
|
ed1rac/AulasEstruturasDados
|
1a351abee539a2be5e73cba60a61c3225c80164b
|
[
"MIT"
] | null | null | null |
2019/## Python/Basico-MacBook-Ed/NaoEhHelloWorld3.py
|
ed1rac/AulasEstruturasDados
|
1a351abee539a2be5e73cba60a61c3225c80164b
|
[
"MIT"
] | 3
|
2017-06-24T00:49:53.000Z
|
2018-03-29T02:09:17.000Z
|
print("Não é um HELLO WORLD!!!!")
| 17
| 33
| 0.617647
| 6
| 34
| 3.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.147059
| 34
| 1
| 34
| 34
| 0.724138
| 0
| 0
| 0
| 0
| 0
| 0.705882
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 6
|
ac334fbcc359be189952b8fd5ed1999a1240ea65
| 486
|
py
|
Python
|
educative/slidingWindow/find_permutation.py
|
monishshah18/python-cp-cheatsheet
|
a5514b08816959de1198156f7764c54a7a585f20
|
[
"Apache-2.0"
] | 140
|
2020-10-21T13:23:52.000Z
|
2022-03-31T15:09:45.000Z
|
educative/slidingWindow/find_permutation.py
|
stacykutyepov/python-cp-cheatsheet
|
a00a57e1b36433648d1cace331e15ff276cef189
|
[
"Apache-2.0"
] | 1
|
2021-07-22T14:01:25.000Z
|
2021-07-22T14:01:25.000Z
|
educative/slidingWindow/find_permutation.py
|
stacykutyepov/python-cp-cheatsheet
|
a00a57e1b36433648d1cace331e15ff276cef189
|
[
"Apache-2.0"
] | 33
|
2020-10-21T14:17:02.000Z
|
2022-03-25T11:25:03.000Z
|
"""
time: 19min
errors:
misread directions, didn't go into big example
permcount = 0
Mis leveled if statement
"""
def find_permutation(str, pattern):
return False
def main():
print('Permutation exist: ' + str(find_permutation("oidbcaf", "abc")))
print('Permutation exist: ' + str(find_permutation("odicf", "dc")))
print('Permutation exist: ' + str(find_permutation("bcdxabcdy", "bcdyabcdx")))
print('Permutation exist: ' + str(find_permutation("aaacb", "abc")))
main()
| 21.130435
| 80
| 0.695473
| 59
| 486
| 5.644068
| 0.576271
| 0.225225
| 0.252252
| 0.288288
| 0.468468
| 0.468468
| 0
| 0
| 0
| 0
| 0
| 0.007177
| 0.139918
| 486
| 22
| 81
| 22.090909
| 0.789474
| 0.218107
| 0
| 0
| 0
| 0
| 0.319892
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0.125
| 0.375
| 0.5
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
|
0
| 6
|
ac34514b121e2c2a77e3099e51364e3fa0b62b4c
| 18,891
|
py
|
Python
|
custom_components/ipx800v5/light.py
|
Aohzan/ipx800v5
|
2aeaa6e7f5f9cb19469d334fc13ce6aab19441b6
|
[
"Apache-2.0"
] | 2
|
2021-12-03T23:53:22.000Z
|
2022-01-20T10:53:05.000Z
|
custom_components/ipx800v5/light.py
|
Aohzan/ipx800v5
|
2aeaa6e7f5f9cb19469d334fc13ce6aab19441b6
|
[
"Apache-2.0"
] | 3
|
2021-12-06T21:28:54.000Z
|
2022-01-20T10:16:30.000Z
|
custom_components/ipx800v5/light.py
|
Aohzan/ipx800v5
|
2aeaa6e7f5f9cb19469d334fc13ce6aab19441b6
|
[
"Apache-2.0"
] | null | null | null |
"""Support for IPX800 V5 lights."""
from asyncio import gather as async_gather
import logging
from pypx800v5 import IPX800, X8R, XPWM, IPX800Relay, XDimmer
from pypx800v5.const import EXT_X8R, EXT_XDIMMER, EXT_XPWM, IPX
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_RGB_COLOR,
ATTR_RGBW_COLOR,
ATTR_TRANSITION,
COLOR_MODE_BRIGHTNESS,
COLOR_MODE_ONOFF,
COLOR_MODE_RGB,
COLOR_MODE_RGBW,
LightEntity,
LightEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_TYPE
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from .const import (
CONF_DEFAULT_BRIGHTNESS,
CONF_DEVICES,
CONF_EXT_TYPE,
CONF_TRANSITION,
CONTROLLER,
COORDINATOR,
DEFAULT_TRANSITION,
DOMAIN,
TYPE_XPWM_RGB,
TYPE_XPWM_RGBW,
)
from .tools_ipx_entity import IpxEntity
_LOGGER = logging.getLogger(__name__)
def scaleto255(value):
"""Scale to Home-Assistant value."""
return max(0, min(255, round((value * 255.0) / 100.0)))
def scaleto100(value):
"""Scale to IPX800 value."""
return max(0, min(100, round((value * 100.0) / 255.0)))
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the IPX800 lights."""
controller = hass.data[DOMAIN][entry.entry_id][CONTROLLER]
coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR]
devices = hass.data[DOMAIN][entry.entry_id][CONF_DEVICES]["light"]
entities: list[LightEntity] = []
for device in devices:
if device[CONF_EXT_TYPE] == IPX:
entities.append(IpxLight(device, controller, coordinator))
if device[CONF_EXT_TYPE] == EXT_X8R:
entities.append(X8RLight(device, controller, coordinator))
elif device[CONF_EXT_TYPE] == EXT_XDIMMER:
entities.append(XDimmerLight(device, controller, coordinator))
elif device[CONF_EXT_TYPE] == EXT_XPWM and CONF_TYPE not in device:
entities.append(XPWMLight(device, controller, coordinator))
elif (
device[CONF_EXT_TYPE] == EXT_XPWM and device.get(CONF_TYPE) == TYPE_XPWM_RGB
):
entities.append(XPWMRGBLight(device, controller, coordinator))
elif (
device[CONF_EXT_TYPE] == EXT_XPWM
and device.get(CONF_TYPE) == TYPE_XPWM_RGBW
):
entities.append(XPWMRGBWLight(device, controller, coordinator))
async_add_entities(entities, True)
class IpxLight(IpxEntity, LightEntity):
"""Representation of a IPX light through relay."""
def __init__(
self,
device_config: dict,
ipx: IPX800,
coordinator: DataUpdateCoordinator,
) -> None:
"""Initialize the RelayLight."""
super().__init__(device_config, ipx, coordinator)
self.control = IPX800Relay(ipx, self._io_number)
self._attr_supported_color_modes = {COLOR_MODE_ONOFF}
self._attr_color_mode = COLOR_MODE_ONOFF
@property
def is_on(self) -> bool:
"""Return if the light is on."""
return self.coordinator.data[self.control.io_state_id]["on"] == 1
async def async_turn_on(self, **kwargs) -> None:
"""Turn on the light."""
await self.control.on()
await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs) -> None:
"""Turn off the light."""
await self.control.off()
await self.coordinator.async_request_refresh()
async def async_toggle(self, **kwargs) -> None:
"""Toggle the light."""
await self.control.toggle()
await self.coordinator.async_request_refresh()
class X8RLight(IpxEntity, LightEntity):
"""Representation of a X-8R light through relay."""
def __init__(
self,
device_config: dict,
ipx: IPX800,
coordinator: DataUpdateCoordinator,
) -> None:
"""Initialize the RelayLight."""
super().__init__(device_config, ipx, coordinator)
self.control = X8R(ipx, self._ext_number, self._io_number)
self._attr_supported_color_modes = {COLOR_MODE_ONOFF}
self._attr_color_mode = COLOR_MODE_ONOFF
@property
def is_on(self) -> bool:
"""Return if the light is on."""
return self.coordinator.data[self.control.io_state_id]["on"] == 1
async def async_turn_on(self, **kwargs) -> None:
"""Turn on the light."""
await self.control.on()
await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs) -> None:
"""Turn off the light."""
await self.control.off()
await self.coordinator.async_request_refresh()
async def async_toggle(self, **kwargs) -> None:
"""Toggle the light."""
await self.control.toggle()
await self.coordinator.async_request_refresh()
class XDimmerLight(IpxEntity, LightEntity):
"""Representation of a IPX Light through X-Dimmer."""
def __init__(
self,
device_config: dict,
ipx: IPX800,
coordinator: DataUpdateCoordinator,
) -> None:
"""Initialize the class XDimmerLight."""
super().__init__(device_config, ipx, coordinator)
self.control = XDimmer(ipx, self._ext_number, self._io_number)
self._transition = device_config.get(CONF_TRANSITION, DEFAULT_TRANSITION)
self._attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
self._attr_color_mode = COLOR_MODE_BRIGHTNESS
self._attr_supported_features = LightEntityFeature.TRANSITION
@property
def is_on(self) -> bool:
"""Return if the light is on."""
return self.coordinator.data[self.control.io_state_id]["on"] == 1
@property
def brightness(self) -> int:
"""Return the brightness of the light."""
return scaleto255(self.coordinator.data[self.control.ana_state_id]["value"])
async def async_turn_on(self, **kwargs) -> None:
"""Turn on the light."""
if ATTR_TRANSITION in kwargs:
self._transition = kwargs[ATTR_TRANSITION]
if ATTR_BRIGHTNESS in kwargs:
await self.control.set_level(
scaleto100(kwargs[ATTR_BRIGHTNESS]), self._transition * 1000
)
else:
await self.control.on(self._transition * 1000)
await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs) -> None:
"""Turn off the light."""
if ATTR_TRANSITION in kwargs:
self._transition = kwargs[ATTR_TRANSITION]
await self.control.off(self._transition * 1000)
await self.coordinator.async_request_refresh()
async def async_toggle(self, **kwargs) -> None:
"""Toggle the light."""
if ATTR_TRANSITION in kwargs:
self._transition = kwargs[ATTR_TRANSITION]
await self.control.toggle(self._transition * 1000)
await self.coordinator.async_request_refresh()
class XPWMLight(IpxEntity, LightEntity):
"""Representation of a IPX Light through X-PWM single channel."""
def __init__(
self,
device_config: dict,
ipx: IPX800,
coordinator: DataUpdateCoordinator,
) -> None:
"""Initialize the XPWMLight."""
super().__init__(device_config, ipx, coordinator)
self.control = XPWM(ipx, self._ext_number, self._io_number)
self._default_brightness = scaleto100(
device_config.get(CONF_DEFAULT_BRIGHTNESS, 255)
)
self._transition = device_config.get(CONF_TRANSITION, DEFAULT_TRANSITION)
self._attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
self._attr_color_mode = COLOR_MODE_BRIGHTNESS
self._attr_supported_features = LightEntityFeature.TRANSITION
@property
def is_on(self) -> bool:
"""Return if the light is on."""
return self.coordinator.data[self.control.ana_state_id]["value"] > 0
@property
def brightness(self) -> int:
"""Return the brightness of the light."""
return scaleto255(self.coordinator.data[self.control.ana_state_id]["value"])
async def async_turn_on(self, **kwargs) -> None:
"""Turn on the light."""
if ATTR_TRANSITION in kwargs:
self._transition = kwargs[ATTR_TRANSITION]
if ATTR_BRIGHTNESS in kwargs:
await self.control.set_level(
scaleto100(kwargs[ATTR_BRIGHTNESS]), self._transition * 1000
)
else:
await self.control.on(self._transition * 1000)
await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs) -> None:
"""Turn off the light."""
if ATTR_TRANSITION in kwargs:
self._transition = kwargs[ATTR_TRANSITION]
await self.control.off(self._transition * 1000)
await self.coordinator.async_request_refresh()
async def async_toggle(self, **kwargs) -> None:
"""Toggle the light."""
if ATTR_TRANSITION in kwargs:
self._transition = kwargs[ATTR_TRANSITION]
await self.control.toggle(self._transition * 1000)
await self.coordinator.async_request_refresh()
class XPWMRGBLight(IpxEntity, LightEntity):
"""Representation of a RGB light through 3 X-PWM channels."""
def __init__(
self,
device_config: dict,
ipx: IPX800,
coordinator: DataUpdateCoordinator,
) -> None:
"""Initialize the XPWMRGBLight."""
super().__init__(device_config, ipx, coordinator)
self.xpwm_rgb_r = XPWM(ipx, self._ext_number, self._io_numbers[0])
self.xpwm_rgb_g = XPWM(ipx, self._ext_number, self._io_numbers[1])
self.xpwm_rgb_b = XPWM(ipx, self._ext_number, self._io_numbers[2])
self._default_brightness = scaleto100(
device_config.get(CONF_DEFAULT_BRIGHTNESS, 255)
)
self._transition = device_config.get(CONF_TRANSITION, DEFAULT_TRANSITION)
self._attr_supported_color_modes = {COLOR_MODE_RGB}
self._attr_color_mode = COLOR_MODE_RGB
self._attr_supported_features = LightEntityFeature.TRANSITION
@property
def is_on(self) -> bool:
"""Return if at least a level in on."""
return any(i > 0 for i in self.rgb_color)
@property
def brightness(self) -> int:
"""Return the brightness from levels."""
return max(self.rgb_color)
@property
def rgb_color(self):
"""Return the RGB color from RGB levels."""
level_r = scaleto255(
self.coordinator.data[self.xpwm_rgb_r.ana_state_id]["value"]
)
level_g = scaleto255(
self.coordinator.data[self.xpwm_rgb_g.ana_state_id]["value"]
)
level_b = scaleto255(
self.coordinator.data[self.xpwm_rgb_b.ana_state_id]["value"]
)
return (level_r, level_g, level_b)
async def async_turn_on(self, **kwargs) -> None:
"""Turn on the light."""
if ATTR_TRANSITION in kwargs:
self._transition = kwargs[ATTR_TRANSITION]
if ATTR_RGB_COLOR in kwargs:
colors = kwargs[ATTR_RGB_COLOR]
await async_gather(
self.xpwm_rgb_r.set_level(
scaleto100(colors[0]), self._transition * 1000
),
self.xpwm_rgb_g.set_level(
scaleto100(colors[1]), self._transition * 1000
),
self.xpwm_rgb_b.set_level(
scaleto100(colors[2]), self._transition * 1000
),
)
elif ATTR_BRIGHTNESS in kwargs:
brightness = kwargs[ATTR_BRIGHTNESS]
if self.is_on:
await async_gather(
self.xpwm_rgb_r.set_level(
scaleto100(self.rgb_color[0] * brightness / self.brightness),
self._transition * 1000,
),
self.xpwm_rgb_g.set_level(
scaleto100(self.rgb_color[1] * brightness / self.brightness),
self._transition * 1000,
),
self.xpwm_rgb_b.set_level(
scaleto100(self.rgb_color[2] * brightness / self.brightness),
self._transition * 1000,
),
)
else:
await async_gather(
self.xpwm_rgb_r.set_level(
scaleto100(brightness),
self._transition * 1000,
),
self.xpwm_rgb_g.set_level(
scaleto100(brightness),
self._transition * 1000,
),
self.xpwm_rgb_b.set_level(
scaleto100(brightness),
self._transition * 1000,
),
)
else:
await async_gather(
self.xpwm_rgb_r.set_level(
scaleto100(self._default_brightness),
self._transition * 1000,
),
self.xpwm_rgb_g.set_level(
scaleto100(self._default_brightness),
self._transition * 1000,
),
self.xpwm_rgb_b.set_level(
scaleto100(self._default_brightness),
self._transition * 1000,
),
)
await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs) -> None:
"""Turn off the light."""
if ATTR_TRANSITION in kwargs:
self._transition = kwargs[ATTR_TRANSITION]
await async_gather(
self.xpwm_rgb_r.off(self._transition * 1000),
self.xpwm_rgb_g.off(self._transition * 1000),
self.xpwm_rgb_b.off(self._transition * 1000),
)
await self.coordinator.async_request_refresh()
class XPWMRGBWLight(IpxEntity, LightEntity):
"""Representation of a RGBW light through 4 X-PWM channels."""
def __init__(
self,
device_config: dict,
ipx: IPX800,
coordinator: DataUpdateCoordinator,
) -> None:
"""Initialize the XPWMRGBWLight."""
super().__init__(device_config, ipx, coordinator)
self.xpwm_rgbw_r = XPWM(ipx, self._ext_number, self._io_numbers[0])
self.xpwm_rgbw_g = XPWM(ipx, self._ext_number, self._io_numbers[1])
self.xpwm_rgbw_b = XPWM(ipx, self._ext_number, self._io_numbers[2])
self.xpwm_rgbw_w = XPWM(ipx, self._ext_number, self._io_numbers[3])
self._default_brightness = scaleto100(
device_config.get(CONF_DEFAULT_BRIGHTNESS, 255)
)
self._transition = device_config.get(CONF_TRANSITION, DEFAULT_TRANSITION)
self._attr_supported_color_modes = {COLOR_MODE_RGBW}
self._attr_color_mode = COLOR_MODE_RGBW
self._attr_supported_features = LightEntityFeature.TRANSITION
@property
def is_on(self) -> bool:
"""Return if at least a level in on."""
return any(i > 0 for i in self.rgbw_color)
@property
def brightness(self) -> int:
"""Return the brightness from levels."""
return max(self.rgbw_color)
@property
def rgbw_color(self):
"""Return the RGB color from RGB levels."""
level_r = scaleto255(
self.coordinator.data[self.xpwm_rgbw_r.ana_state_id]["value"]
)
level_g = scaleto255(
self.coordinator.data[self.xpwm_rgbw_g.ana_state_id]["value"]
)
level_b = scaleto255(
self.coordinator.data[self.xpwm_rgbw_b.ana_state_id]["value"]
)
level_w = scaleto255(
self.coordinator.data[self.xpwm_rgbw_w.ana_state_id]["value"]
)
return (level_r, level_g, level_b, level_w)
async def async_turn_on(self, **kwargs) -> None:
"""Turn on the light."""
if ATTR_TRANSITION in kwargs:
self._transition = kwargs[ATTR_TRANSITION]
if ATTR_RGBW_COLOR in kwargs:
colors = kwargs[ATTR_RGBW_COLOR]
# if only rgb color have been set
await async_gather(
self.xpwm_rgbw_r.set_level(
scaleto100(colors[0]), self._transition * 1000
),
self.xpwm_rgbw_g.set_level(
scaleto100(colors[1]), self._transition * 1000
),
self.xpwm_rgbw_b.set_level(
scaleto100(colors[2]), self._transition * 1000
),
self.xpwm_rgbw_w.set_level(
scaleto100(colors[3]), self._transition * 1000
),
)
elif ATTR_BRIGHTNESS in kwargs:
brightness = kwargs[ATTR_BRIGHTNESS]
if self.is_on:
await async_gather(
self.xpwm_rgbw_r.set_level(
scaleto100(self.rgbw_color[0] * brightness / self.brightness),
self._transition * 1000,
),
self.xpwm_rgbw_g.set_level(
scaleto100(self.rgbw_color[1] * brightness / self.brightness),
self._transition * 1000,
),
self.xpwm_rgbw_b.set_level(
scaleto100(self.rgbw_color[2] * brightness / self.brightness),
self._transition * 1000,
),
self.xpwm_rgbw_w.set_level(
scaleto100(self.rgbw_color[3] * brightness / self.brightness),
self._transition * 1000,
),
)
else:
await self.xpwm_rgbw_w.set_level(
scaleto100(brightness),
self._transition * 1000,
)
else:
await self.xpwm_rgbw_w.set_level(
self._default_brightness, self._transition * 1000
)
await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs) -> None:
"""Turn off the light."""
if ATTR_TRANSITION in kwargs:
self._transition = kwargs[ATTR_TRANSITION]
await async_gather(
self.xpwm_rgbw_w.off(self._transition * 1000),
self.xpwm_rgbw_r.off(self._transition * 1000),
self.xpwm_rgbw_g.off(self._transition * 1000),
self.xpwm_rgbw_b.off(self._transition * 1000),
)
await self.coordinator.async_request_refresh()
| 36.896484
| 88
| 0.60685
| 2,102
| 18,891
| 5.161275
| 0.074691
| 0.065813
| 0.061388
| 0.038529
| 0.842658
| 0.817771
| 0.795834
| 0.774081
| 0.740621
| 0.720343
| 0
| 0.028062
| 0.296385
| 18,891
| 511
| 89
| 36.968689
| 0.788143
| 0.052724
| 0
| 0.647643
| 0
| 0
| 0.003517
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.049628
| false
| 0
| 0.029777
| 0
| 0.129032
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
3ba3ec4876e7b21dc208751382042621a4cdf030
| 32,899
|
py
|
Python
|
impohhciscofmcapi/impohhfmcapi.py
|
impohh/impohhciscofmcapi
|
daa0f95473aa6de727b1687d77bb66d38d7b9559
|
[
"MIT"
] | null | null | null |
impohhciscofmcapi/impohhfmcapi.py
|
impohh/impohhciscofmcapi
|
daa0f95473aa6de727b1687d77bb66d38d7b9559
|
[
"MIT"
] | null | null | null |
impohhciscofmcapi/impohhfmcapi.py
|
impohh/impohhciscofmcapi
|
daa0f95473aa6de727b1687d77bb66d38d7b9559
|
[
"MIT"
] | null | null | null |
#
# Generated FMC REST API sample script
#
import json
import sys
import requests
import os
import time
from openpyxl import Workbook
from openpyxl.styles import Color, Border, Side, PatternFill, Font, GradientFill, Alignment, colors
## Function Connect API FMC ##
def connect(server,username,password):
global g_server, g_username, g_password, g_domain_uuid, g_headers
g_server = server
if (g_server[-1] == '/'):
g_server = g_server[:-1]
g_username = username
g_password = password
r = None
g_headers = {'Content-Type': 'application/json'}
api_auth_path = "/api/fmc_platform/v1/auth/generatetoken"
auth_url = g_server + api_auth_path
try:
# 2 ways of making a REST call are provided:
# One with "SSL verification turned off" and the other with "SSL verification turned on".
# The one with "SSL verification turned off" is commented out. If you like to use that then
# uncomment the line where verify=False and comment the line with =verify='/path/to/ssl_certificate'
# REST call with SSL verification turned off:
# r = requests.post(auth_url, headers=headers, auth=requests.auth.HTTPBasicAuth(username,password), verify=False)
# REST call with SSL verification turned on: Download SSL certificates from your FMC first and provide its path for verification.
r = requests.post(auth_url, headers=g_headers, auth=requests.auth.HTTPBasicAuth(username,password), verify=False)
auth_headers = r.headers
print (r.headers)
#print ("Domain UUID = " + r.headers["DOMAIN_UUID"])
auth_token = auth_headers.get('X-auth-access-token', default=None)
refresh_token = auth_headers.get('X-auth-refresh-token', default=None)
if auth_token == None and refresh_token == None:
print("auth_token not found. Exiting...")
sys.exit()
except Exception as err:
print ("Error in generating auth token --> "+str(err))
sys.exit()
g_headers['X-auth-access-token'] = auth_token
g_headers['X-auth-refresh-token'] = refresh_token
print ("++++++++ headers ++++++++ : "+str(g_headers))
g_domain_uuid = r.headers["DOMAIN_UUID"]
print ("++++++++ g_domain_uuid ++++++++ : " + g_domain_uuid)
print ("-------- Username -------- : " + g_username)
print ("-------- Password -------- : " + g_password)
def get_url(url):
try:
r = None
r = requests.get(url, headers=g_headers, verify=False)
status_code = r.status_code
resp = r.text
time.sleep(0.5)
if (status_code == 200):
print("GET successful. Response data --> ")
json_resp = json.loads(resp)
# print(json.dumps(json_resp,sort_keys=True,indent=4, separators=(',', ': ')))
elif (status_code == 401):
print("+++++++++ Unauthorized +++++++++")
r.close()
connect(g_server, g_username, g_password)
json_resp = get_url(url)
else:
r.raise_for_status()
print("Error occurred in GET --> "+resp)
except requests.exceptions.HTTPError as err:
print ("Error in connection --> "+str(err))
finally:
if r : r.close()
return json_resp
## Function API Get NetworkAddresses ##
def get_networkaddresses():
offset = 0
limit = 1000
index = 2
paging = 1
## Create workbook, sheet in Excel ##
wb = Workbook()
ws_NetworkAddresses = wb.active
ws_NetworkAddresses.title = "NetworkAddresses"
## Header NetworkAddresses in Excel ##
ws_NetworkAddresses["A1"] = "ID_Objects"
ws_NetworkAddresses["A1"].font = Font(bold=True)
ws_NetworkAddresses["B1"] = "Name"
ws_NetworkAddresses["B1"].font = Font(bold=True)
ws_NetworkAddresses["C1"] = "Type"
ws_NetworkAddresses["C1"].font = Font(bold=True)
ws_NetworkAddresses["D1"] = "Value"
ws_NetworkAddresses["D1"].font = Font(bold=True)
ws_NetworkAddresses["E1"] = "Description"
ws_NetworkAddresses["E1"].font = Font(bold=True)
ws_NetworkAddresses["F1"] = "Overridable"
ws_NetworkAddresses["F1"].font = Font(bold=True)
ws_NetworkAddresses["G1"] = "Status"
ws_NetworkAddresses["G1"].font = Font(bold=True)
api_path = "/api/fmc_config/v1/domain/" + g_domain_uuid + "/object/networkaddresses?offset=" + str(offset) + "&limit=" +str(limit) # param
url = g_server + api_path
json_resp = get_url(url)
count = json_resp["paging"]["count"]
print ("************ Pages total : " + str(json_resp["paging"]["pages"]) + " ************")
for offset_num in range (offset,count,limit):
print ("************ paging = " + str(paging) + ", offset = " + str(offset_num) + ", limit = " + str(limit) + " ************")
api_path = "/api/fmc_config/v1/domain/" + g_domain_uuid + "/object/networkaddresses?offset=" + str(offset_num) + "&limit=" +str(limit) # param
url = g_server + api_path
json_resp = get_url(url)
for data in json_resp["items"]:
#print (json.dumps(data['id'],sort_keys=True,indent=4, separators=(',', ': ')))
print ("---------------------------------------------")
# Get value in networkaddresses
url = data["links"]["self"] # param
json_resp = get_url(url)
print(json.dumps(json_resp,sort_keys=True,indent=4, separators=(',', ': ')))
if not "readOnly" in json_resp["metadata"]:
# print ("id : " + json_resp["id"])
# print ("name : " + json_resp["name"])
# print ("type : " + json_resp["type"])
# print ("value : " + json_resp["value"])
# print ("description : " + json_resp["description"])
ws_NetworkAddresses["A" + str(index)] = json_resp["id"]
ws_NetworkAddresses["B" + str(index)] = json_resp["name"]
ws_NetworkAddresses["C" + str(index)] = json_resp["type"]
ws_NetworkAddresses["D" + str(index)] = json_resp["value"]
ws_NetworkAddresses["E" + str(index)] = json_resp["description"]
ws_NetworkAddresses["F" + str(index)] = str(json_resp["overridable"])
index += 1
else :
# print ("id : " + json_resp["id"])
# print ("name : " + json_resp["name"])
# print ("type : " + json_resp["type"])
# print ("value : " + json_resp["value"])
# print ("description : " + json_resp["description"])
ws_NetworkAddresses["A" + str(index)] = json_resp["id"]
ws_NetworkAddresses["B" + str(index)] = json_resp["name"]
ws_NetworkAddresses["C" + str(index)] = json_resp["type"]
ws_NetworkAddresses["D" + str(index)] = json_resp["value"]
ws_NetworkAddresses["E" + str(index)] = json_resp["description"]
ws_NetworkAddresses["F" + str(index)] = str(json_resp["overridable"])
ws_NetworkAddresses["G" + str(index)] = json_resp["metadata"]["readOnly"]["reason"]
index += 1
paging += 1
print ("\n")
print ("NetworkAddresses Total = " + str(count))
desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
print("The Desktop path is: " + desktop)
wb.save(desktop + "/NetworkAddresses.xlsx")
## Function API Get NetworkGroups ##
def get_networkgroups():
offset = 0
limit = 1000
index = 2
paging = 1
## Create workbook, sheet in Excel ##
wb = Workbook()
ws_NetworkGroups = wb.active
ws_NetworkGroups.title = "NetworkGroups"
## Header NetworkGroups in Excel ##
ws_NetworkGroups["A1"] = "ID_Groups"
ws_NetworkGroups["A1"].font = Font(bold=True)
ws_NetworkGroups["B1"] = "Name"
ws_NetworkGroups["B1"].font = Font(bold=True)
ws_NetworkGroups["C1"] = "Type"
ws_NetworkGroups["C1"].font = Font(bold=True)
ws_NetworkGroups["D1"] = "Description"
ws_NetworkGroups["D1"].font = Font(bold=True)
ws_NetworkGroups["E1"] = "Overridable"
ws_NetworkGroups["E1"].font = Font(bold=True)
ws_NetworkGroups["F1"] = "Status"
ws_NetworkGroups["F1"].font = Font(bold=True)
ws_NetworkGroups["G1"] = "Literals_type"
ws_NetworkGroups["G1"].font = Font(bold=True)
ws_NetworkGroups["H1"] = "Literals_value"
ws_NetworkGroups["H1"].font = Font(bold=True)
ws_NetworkGroups["I1"] = "Objects_ID"
ws_NetworkGroups["I1"].font = Font(bold=True)
ws_NetworkGroups["J1"] = "Objects_name"
ws_NetworkGroups["J1"].font = Font(bold=True)
ws_NetworkGroups["K1"] = "Objects_type"
ws_NetworkGroups["K1"].font = Font(bold=True)
api_path = "/api/fmc_config/v1/domain/" + g_domain_uuid + "/object/networkgroups?offset=" + str(offset) + "&limit=" +str(limit) # param
url = g_server + api_path
json_resp = get_url(url)
count = json_resp["paging"]["count"]
print ("************ Pages total : " + str(json_resp["paging"]["pages"]) + " ************")
for offset_num in range (offset,count,limit):
print ("************ paging = " + str(paging) + ", offset = " + str(offset_num) + ", limit = " + str(limit) + " ************")
api_path = "/api/fmc_config/v1/domain/" + g_domain_uuid + "/object/networkgroups?offset=" + str(offset_num) + "&limit=" +str(limit) # param
url = g_server + api_path
json_resp = get_url(url)
for data in json_resp['items']:
#print (json.dumps(data['id'],sort_keys=True,indent=4, separators=(',', ': ')))
print ('---------------------------------------------')
url = data["links"]["self"] # param
json_resp = get_url(url)
print(json.dumps(json_resp,sort_keys=True,indent=4, separators=(',', ': ')))
if not "readOnly" in json_resp["metadata"]: ## Not readOnly ##
if "literals" in json_resp and "objects" in json_resp:
print ("************** literals and objects **************")
index_literals = index
index_objects = index
for literals in json_resp["literals"]:
# print ("literals type : " + literals["type"])
# print ("literals value : " + literals["value"])
ws_NetworkGroups["A" + str(index_literals)] = json_resp["id"]
ws_NetworkGroups["B" + str(index_literals)] = json_resp["name"]
ws_NetworkGroups["C" + str(index_literals)] = json_resp["type"]
ws_NetworkGroups["D" + str(index_literals)] = json_resp["description"]
ws_NetworkGroups["E" + str(index_literals)] = json_resp["overridable"]
ws_NetworkGroups["G" + str(index_literals)] = literals["type"]
ws_NetworkGroups["H" + str(index_literals)] = literals["value"]
index_literals += 1
for objects in json_resp["objects"]:
# print ("objects id : " + objects["id"])
# print ("objects name : " + objects["name"])
# print ("objects type : " + objects["type"])
ws_NetworkGroups["A" + str(index_objects)] = json_resp["id"]
ws_NetworkGroups["B" + str(index_objects)] = json_resp["name"]
ws_NetworkGroups["C" + str(index_objects)] = json_resp["type"]
ws_NetworkGroups["D" + str(index_objects)] = json_resp["description"]
ws_NetworkGroups["E" + str(index_objects)] = json_resp["overridable"]
ws_NetworkGroups["I" + str(index_objects)] = objects["id"]
ws_NetworkGroups["J" + str(index_objects)] = objects["name"]
ws_NetworkGroups["K" + str(index_objects)] = objects["type"]
index_objects += 1
if index_literals > index_objects:
index = index_literals
else :
index = index_objects
elif "literals" in json_resp:
print ("************** literals **************")
for literals in json_resp["literals"]:
# print ("literals type : " + literals["type"])
# print ("literals value : " + literals["value"])
ws_NetworkGroups["A" + str(index)] = json_resp["id"]
ws_NetworkGroups["B" + str(index)] = json_resp["name"]
ws_NetworkGroups["C" + str(index)] = json_resp["type"]
ws_NetworkGroups["D" + str(index)] = json_resp["description"]
ws_NetworkGroups["E" + str(index)] = json_resp["overridable"]
ws_NetworkGroups["G" + str(index)] = literals["type"]
ws_NetworkGroups["H" + str(index)] = literals["value"]
index += 1
elif "objects" in json_resp:
print ("************** objects **************")
for objects in json_resp["objects"]:
# print ("objects id : " + objects["id"])
# print ("objects name : " + objects["name"])
# print ("objects type : " + objects["type"])
ws_NetworkGroups["A" + str(index)] = json_resp["id"]
ws_NetworkGroups["B" + str(index)] = json_resp["name"]
ws_NetworkGroups["C" + str(index)] = json_resp["type"]
ws_NetworkGroups["D" + str(index)] = json_resp["description"]
ws_NetworkGroups["E" + str(index)] = json_resp["overridable"]
ws_NetworkGroups["I" + str(index)] = objects["id"]
ws_NetworkGroups["J" + str(index)] = objects["name"]
ws_NetworkGroups["K" + str(index)] = objects["type"]
index += 1
else :
pass
else : ## readOnly ##
if "literals" in json_resp and "objects" in json_resp:
print ("************** literals and objects **************")
index_literals = index
index_objects = index
for literals in json_resp["literals"]:
# print ("literals type : " + literals["type"])
# print ("literals value : " + literals["value"])
ws_NetworkGroups["A" + str(index_literals)] = json_resp["id"]
ws_NetworkGroups["B" + str(index_literals)] = json_resp["name"]
ws_NetworkGroups["C" + str(index_literals)] = json_resp["type"]
ws_NetworkGroups["D" + str(index_literals)] = json_resp["description"]
ws_NetworkGroups["E" + str(index_literals)] = json_resp["overridable"]
ws_NetworkGroups["F" + str(index_literals)] = json_resp["metadata"]["readOnly"]["reason"]
ws_NetworkGroups["G" + str(index_literals)] = literals["type"]
ws_NetworkGroups["H" + str(index_literals)] = literals["value"]
index_literals += 1
for objects in json_resp["objects"]:
# print ("objects id : " + objects["id"])
# print ("objects name : " + objects["name"])
# print ("objects type : " + objects["type"])
ws_NetworkGroups["A" + str(index_objects)] = json_resp["id"]
ws_NetworkGroups["B" + str(index_objects)] = json_resp["name"]
ws_NetworkGroups["C" + str(index_objects)] = json_resp["type"]
ws_NetworkGroups["D" + str(index_objects)] = json_resp["description"]
ws_NetworkGroups["E" + str(index_objects)] = json_resp["overridable"]
ws_NetworkGroups["F" + str(index_objects)] = json_resp["metadata"]["readOnly"]["reason"]
ws_NetworkGroups["I" + str(index_objects)] = objects["id"]
ws_NetworkGroups["J" + str(index_objects)] = objects["name"]
ws_NetworkGroups["K" + str(index_objects)] = objects["type"]
index_objects += 1
if index_literals > index_objects:
index = index_literals
else :
index = index_objects
elif "literals" in json_resp:
print ("************** literals **************")
for literals in json_resp["literals"]:
# print ("literals type : " + literals["type"])
# print ("literals value : " + literals["value"])
ws_NetworkGroups["A" + str(index)] = json_resp["id"]
ws_NetworkGroups["B" + str(index)] = json_resp["name"]
ws_NetworkGroups["C" + str(index)] = json_resp["type"]
ws_NetworkGroups["D" + str(index)] = json_resp["description"]
ws_NetworkGroups["E" + str(index)] = json_resp["overridable"]
ws_NetworkGroups["F" + str(index)] = json_resp["metadata"]["readOnly"]["reason"]
ws_NetworkGroups["G" + str(index)] = literals["type"]
ws_NetworkGroups["H" + str(index)] = literals["value"]
index += 1
elif "objects" in json_resp:
print ("************** objects **************")
for objects in json_resp["objects"]:
# print ("objects id : " + objects["id"])
# print ("objects name : " + objects["name"])
# print ("objects type : " + objects["type"])
ws_NetworkGroups["A" + str(index)] = json_resp["id"]
ws_NetworkGroups["B" + str(index)] = json_resp["name"]
ws_NetworkGroups["C" + str(index)] = json_resp["type"]
ws_NetworkGroups["D" + str(index)] = json_resp["description"]
ws_NetworkGroups["E" + str(index)] = json_resp["overridable"]
ws_NetworkGroups["F" + str(index)] = json_resp["metadata"]["readOnly"]["reason"]
ws_NetworkGroups["I" + str(index)] = objects["id"]
ws_NetworkGroups["J" + str(index)] = objects["name"]
ws_NetworkGroups["K" + str(index)] = objects["type"]
index += 1
else :
pass
paging += 1
print ("\n")
print ("NetworkGroups Total = " + str(count))
desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
print("The Desktop path is: " + desktop)
wb.save(desktop + "/NetworkGroups.xlsx")
## Function API Get Ports ##
def get_ports():
offset = 0
limit = 1000
index = 2
paging = 1
## Create workbook, sheet in Excel ##
wb = Workbook()
ws_Ports = wb.active
ws_Ports.title = "PortObjects"
## Header NetworkGroups in Excel ##
ws_Ports["A1"] = "ID_Ports"
ws_Ports["A1"].font = Font(bold=True)
ws_Ports["B1"] = "Name"
ws_Ports["B1"].font = Font(bold=True)
ws_Ports["C1"] = "Type"
ws_Ports["C1"].font = Font(bold=True)
ws_Ports["D1"] = "Protocal"
ws_Ports["D1"].font = Font(bold=True)
ws_Ports["E1"] = "Ports"
ws_Ports["E1"].font = Font(bold=True)
ws_Ports["F1"] = "Description"
ws_Ports["F1"].font = Font(bold=True)
ws_Ports["G1"] = "Overridable"
ws_Ports["G1"].font = Font(bold=True)
ws_Ports["H1"] = "Status"
ws_Ports["H1"].font = Font(bold=True)
api_path = "/api/fmc_config/v1/domain/" + g_domain_uuid + "/object/ports?offset=" + str(offset) + "&limit=" +str(limit) # param
url = g_server + api_path
json_resp = get_url(url)
count = json_resp["paging"]["count"]
print ("************ Pages total : " + str(json_resp["paging"]["pages"]) + " ************")
for offset_num in range (offset,count,limit):
print ("************ paging = " + str(paging) + ", offset = " + str(offset_num) + ", limit = " + str(limit) + " ************")
api_path = "/api/fmc_config/v1/domain/" + g_domain_uuid + "/object/ports?offset=" + str(offset_num) + "&limit=" +str(limit) # param
url = g_server + api_path
json_resp = get_url(url)
for data in json_resp["items"]:
#index = index + 1
#print (json.dumps(data['id'],sort_keys=True,indent=4, separators=(',', ': ')))
print ("---------------------------------------------")
#print ("links : " + data["links"]["self"])
#print ("index : " + str(index))
#print ("id : " + data["id"])
#print ("name : " + data["name"])
#print ("type : " + data["type"])
# Get value in networkaddresses
url = data["links"]["self"] # param
json_resp = get_url(url)
print(json.dumps(json_resp,sort_keys=True,indent=4, separators=(',', ': ')))
if not "readOnly" in json_resp["metadata"]:
#print(json.dumps(json_resp,sort_keys=True,indent=4, separators=(',', ': ')))
if "ProtocolPortObject" in json_resp["type"]:
#print ("++++++++++++++++++++++++++ ProtocolPortObject ++++++++++++++++++++++++++")
if not "port" in json_resp:
# print ("id : " + json_resp["id"])
# print ("name : " + json_resp["name"])
# print ("type : " + json_resp["type"])
# print ("protocol : " + json_resp["protocol"])
# print ("description : " + json_resp["description"])
# print ("overridable : " + str(json_resp["overridable"]))
ws_Ports["A" + str(index)] = json_resp["id"]
ws_Ports["B" + str(index)] = json_resp["name"]
ws_Ports["C" + str(index)] = json_resp["type"]
ws_Ports["D" + str(index)] = json_resp["protocol"]
#ws_Ports["E" + str(index)] = json_resp["port"]
ws_Ports["F" + str(index)] = json_resp["description"]
ws_Ports["G" + str(index)] = str(json_resp["overridable"])
index += 1
else :
# print ("id : " + json_resp["id"])
# print ("name : " + json_resp["name"])
# print ("type : " + json_resp["type"])
# print ("protocol : " + json_resp["protocol"])
# print ("port : " + json_resp["port"])
# print ("description : " + json_resp["description"])
# print ("overridable : " + str(json_resp["overridable"]))
ws_Ports["A" + str(index)] = json_resp["id"]
ws_Ports["B" + str(index)] = json_resp["name"]
ws_Ports["C" + str(index)] = json_resp["type"]
ws_Ports["D" + str(index)] = json_resp["protocol"]
ws_Ports["E" + str(index)] = json_resp["port"]
ws_Ports["F" + str(index)] = json_resp["description"]
ws_Ports["G" + str(index)] = str(json_resp["overridable"])
index += 1
#elif "ICMPV4Object" in json_resp["type"]:
# print ("++++++++++++++++++++++++++ ICMPV4Object ++++++++++++++++++++++++++")
else :
pass
else :
#print(json.dumps(json_resp,sort_keys=True,indent=4, separators=(',', ': ')))
if "ProtocolPortObject" in json_resp["type"]:
#print ("++++++++++++++++++++++++++ ProtocolPortObject ++++++++++++++++++++++++++")
if not "port" in json_resp:
# print ("id : " + json_resp["id"])
# print ("name : " + json_resp["name"])
# print ("type : " + json_resp["type"])
# print ("protocol : " + json_resp["protocol"])
# print ("description : " + json_resp["description"])
# print ("overridable : " + str(json_resp["overridable"]))
# print ("reason : " + json_resp["metadata"]["readOnly"]["reason"])
ws_Ports["A" + str(index)] = json_resp["id"]
ws_Ports["B" + str(index)] = json_resp["name"]
ws_Ports["C" + str(index)] = json_resp["type"]
ws_Ports["D" + str(index)] = json_resp["protocol"]
#ws_Ports["E" + str(index)] = json_resp["port"]
ws_Ports["F" + str(index)] = json_resp["description"]
ws_Ports["G" + str(index)] = str(json_resp["overridable"])
ws_Ports["H" + str(index)] = json_resp["metadata"]["readOnly"]["reason"]
index += 1
else :
# print ("id : " + json_resp["id"])
# print ("name : " + json_resp["name"])
# print ("type : " + json_resp["type"])
# print ("protocol : " + json_resp["protocol"])
# print ("port : " + json_resp["port"])
# print ("description : " + json_resp["description"])
# print ("overridable : " + str(json_resp["overridable"]))
# print ("reason : " + json_resp["metadata"]["readOnly"]["reason"])
ws_Ports["A" + str(index)] = json_resp["id"]
ws_Ports["B" + str(index)] = json_resp["name"]
ws_Ports["C" + str(index)] = json_resp["type"]
ws_Ports["D" + str(index)] = json_resp["protocol"]
ws_Ports["E" + str(index)] = json_resp["port"]
ws_Ports["F" + str(index)] = json_resp["description"]
ws_Ports["G" + str(index)] = str(json_resp["overridable"])
ws_Ports["H" + str(index)] = json_resp["metadata"]["readOnly"]["reason"]
index += 1
#elif "ICMPV4Object" in json_resp["type"]:
# print ("++++++++++++++++++++++++++ ICMPV4Object ++++++++++++++++++++++++++")
else :
pass
paging += 1
print ("\n")
print ("PortObjects (Only ProtocolPortObject) Total = " + str(count))
desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
print("The Desktop path is: " + desktop)
wb.save(desktop + "/PortObjects.xlsx")
def get_portgroups():
offset = 0
limit = 1000
index = 2
paging = 1
## Create workbook, sheet in Excel ##
wb = Workbook()
ws_PortGroups = wb.active
ws_PortGroups.title = "PortGroups"
## Header NetworkGroups in Excel ##
ws_PortGroups["A1"] = "ID_Groups"
ws_PortGroups["A1"].font = Font(bold=True)
ws_PortGroups["B1"] = "Name"
ws_PortGroups["B1"].font = Font(bold=True)
ws_PortGroups["C1"] = "Type"
ws_PortGroups["C1"].font = Font(bold=True)
ws_PortGroups["D1"] = "Description"
ws_PortGroups["D1"].font = Font(bold=True)
ws_PortGroups["E1"] = "Overridable"
ws_PortGroups["E1"].font = Font(bold=True)
ws_PortGroups["F1"] = "Object_ID"
ws_PortGroups["F1"].font = Font(bold=True)
ws_PortGroups["G1"] = "Object_Name"
ws_PortGroups["G1"].font = Font(bold=True)
ws_PortGroups["H1"] = "Object_Type"
ws_PortGroups["H1"].font = Font(bold=True)
api_path = "/api/fmc_config/v1/domain/" + g_domain_uuid + "/object/portobjectgroups?offset=" + str(offset) + "&limit=" +str(limit) # param
url = g_server + api_path
json_resp = get_url(url)
count = json_resp["paging"]["count"]
print ("************ Pages total : " + str(json_resp["paging"]["pages"]) + " ************")
for offset_num in range (offset,count,limit):
print ("************ paging = " + str(paging) + ", offset = " + str(offset_num) + ", limit = " + str(limit) + " ************")
api_path = "/api/fmc_config/v1/domain/" + g_domain_uuid + "/object/portobjectgroups?offset=" + str(offset_num) + "&limit=" +str(limit) # param
url = g_server + api_path
json_resp = get_url(url)
for data in json_resp["items"]:
#index = index + 1
#print (json.dumps(data['id'],sort_keys=True,indent=4, separators=(',', ': ')))
print ("---------------------------------------------")
#print ("links : " + data["links"]["self"])
#print ("index : " + str(index))
#print ("id : " + data["id"])
#print ("name : " + data["name"])
#print ("type : " + data["type"])
url = data["links"]["self"] # param
json_resp = get_url(url)
print(json.dumps(json_resp,sort_keys=True,indent=4, separators=(',', ': ')))
for objects in json_resp["objects"]:
# print ("********************************************")
# print ("id : " + objects["id"])
# print ("name : " + objects["name"])
# print ("type : " + objects["type"])
ws_PortGroups["A" + str(index)] = json_resp["id"]
ws_PortGroups["B" + str(index)] = json_resp["name"]
ws_PortGroups["C" + str(index)] = json_resp["type"]
ws_PortGroups["D" + str(index)] = json_resp["description"]
ws_PortGroups["E" + str(index)] = str(json_resp["overridable"])
ws_PortGroups["F" + str(index)] = objects["id"]
ws_PortGroups["G" + str(index)] = objects["name"]
ws_PortGroups["H" + str(index)] = objects["type"]
index += 1
print ("\n")
print ("PortGroups Total = " + str(count))
desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
print("The Desktop path is: " + desktop)
wb.save(desktop + "/PortGroups.xlsx")
# def check_paging(url,headers):
# try:
# r = requests.get(url, headers=headers, verify=False)
# status_code = r.status_code
# resp = r.text
# if (status_code == 200):
# print("GET successful. Response data --> ")
# json_resp = json.loads(resp)
# #print(json.dumps(json_resp,sort_keys=True,indent=4, separators=(',', ': ')))
# print(json.dumps(json_resp["paging"],sort_keys=True,indent=4, separators=(',', ': ')))
# count = json_resp["paging"]["count"]
# else:
# r.raise_for_status()
# print("Error occurred in GET --> "+resp)
# except requests.exceptions.HTTPError as err :
# print ("Error in connection --> "+str(err))
# finally:
# if r :
# r.close()
# return count
################ Main Function ################
# if __name__ == '__main__':
# server = "https://xxx.xxx.xxx.xxx"
# username = "username"
# password = "password"
# connect(server, username, password)
# get_networkaddresses()
# get_networkgroups()
# get_ports()
# get_portgroups()
| 45.128944
| 154
| 0.496246
| 3,306
| 32,899
| 4.753479
| 0.067151
| 0.098759
| 0.048107
| 0.064143
| 0.817308
| 0.797455
| 0.713777
| 0.700795
| 0.69965
| 0.688832
| 0
| 0.007118
| 0.33387
| 32,899
| 728
| 155
| 45.190934
| 0.70997
| 0.194839
| 0
| 0.620283
| 1
| 0
| 0.150899
| 0.026521
| 0
| 0
| 0
| 0
| 0
| 1
| 0.014151
| false
| 0.023585
| 0.016509
| 0
| 0.033019
| 0.106132
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
3beaadba30d1dd0a6e1aa97a1c80373815ba88fa
| 96
|
py
|
Python
|
venv/lib/python3.8/site-packages/pip/_internal/utils/logging.py
|
Retraces/UkraineBot
|
3d5d7f8aaa58fa0cb8b98733b8808e5dfbdb8b71
|
[
"MIT"
] | 2
|
2022-03-13T01:58:52.000Z
|
2022-03-31T06:07:54.000Z
|
venv/lib/python3.8/site-packages/pip/_internal/utils/logging.py
|
DesmoSearch/Desmobot
|
b70b45df3485351f471080deb5c785c4bc5c4beb
|
[
"MIT"
] | 19
|
2021-11-20T04:09:18.000Z
|
2022-03-23T15:05:55.000Z
|
venv/lib/python3.8/site-packages/pip/_internal/utils/logging.py
|
DesmoSearch/Desmobot
|
b70b45df3485351f471080deb5c785c4bc5c4beb
|
[
"MIT"
] | null | null | null |
/home/runner/.cache/pip/pool/13/95/44/d67fa9aa075de436a33d03caa66bbb56925577b7408617633d936c6231
| 96
| 96
| 0.895833
| 9
| 96
| 9.555556
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.479167
| 0
| 96
| 1
| 96
| 96
| 0.416667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
ce10c1346950cb743a3357d3225ec5885664acda
| 4,988
|
py
|
Python
|
tests/test_client_device.py
|
buttplugio/buttplug-py
|
ad1972e23143beb5fcb67586f1612d264f87fb17
|
[
"Apache-2.0"
] | 58
|
2018-11-06T12:08:33.000Z
|
2022-02-18T07:10:48.000Z
|
tests/test_client_device.py
|
buttplugio/buttplug-py
|
ad1972e23143beb5fcb67586f1612d264f87fb17
|
[
"Apache-2.0"
] | 13
|
2019-07-23T01:54:00.000Z
|
2021-06-11T17:54:14.000Z
|
tests/test_client_device.py
|
buttplugio/buttplug-py
|
ad1972e23143beb5fcb67586f1612d264f87fb17
|
[
"Apache-2.0"
] | 11
|
2019-10-16T03:11:15.000Z
|
2022-02-25T02:40:49.000Z
|
import unittest
import pytest
import logging
from buttplug.core import (ButtplugMessage, Ok, Error, ButtplugErrorCode,
Test, DeviceAdded, MessageAttributes, DeviceRemoved,
DeviceInfo, DeviceList, VibrateCmd, SpeedSubcommand,
RotateCmd, RotateSubcommand, LinearCmd,
LinearSubcommand)
from buttplug.client import ButtplugClientDevice
class DummyClient(object):
def __init__(self):
self.last_message: ButtplugMessage = None
async def _send_message_expect_ok(self, msg: ButtplugMessage):
logging.debug("Got message")
self.last_message = msg
@pytest.mark.asyncio
async def test_device_vibrate_single_argument():
client = DummyClient()
dev = ButtplugClientDevice(client, DeviceInfo("Test Vibration Device",
0,
{"VibrateCmd":
{"FeatureCount": 1}}))
await dev.send_vibrate_cmd(1.0)
assert client.last_message == VibrateCmd(0, [SpeedSubcommand(0, 1.0)])
@pytest.mark.asyncio
async def test_device_vibrate_list():
client = DummyClient()
dev = ButtplugClientDevice(client, DeviceInfo("Test Vibration Device",
0,
{"VibrateCmd":
{"FeatureCount": 1}}))
await dev.send_vibrate_cmd([1.0])
assert client.last_message == VibrateCmd(0, [SpeedSubcommand(0, 1.0)])
@pytest.mark.asyncio
async def test_device_vibrate_dict():
client = DummyClient()
dev = ButtplugClientDevice(client, DeviceInfo("Test Vibration Device",
0,
{"VibrateCmd":
{"FeatureCount": 1}}))
await dev.send_vibrate_cmd({0: 1.0})
assert client.last_message == VibrateCmd(0, [SpeedSubcommand(0, 1.0)])
@pytest.mark.asyncio
async def test_device_rotate_single_argument():
client = DummyClient()
dev = ButtplugClientDevice(client, DeviceInfo("Test Rotation Device",
0,
{"RotateCmd":
{"FeatureCount": 1}}))
await dev.send_rotate_cmd((1.0, True))
assert client.last_message == RotateCmd(0, [RotateSubcommand(0, 1.0, True)])
@pytest.mark.asyncio
async def test_device_rotate_list():
client = DummyClient()
dev = ButtplugClientDevice(client, DeviceInfo("Test Rotation Device",
0,
{"RotateCmd":
{"FeatureCount": 1}}))
await dev.send_rotate_cmd([(1.0, True)])
assert client.last_message == RotateCmd(0, [RotateSubcommand(0, 1.0, True)])
@pytest.mark.asyncio
async def test_device_rotate_dict():
client = DummyClient()
dev = ButtplugClientDevice(client, DeviceInfo("Test Rotation Device",
0,
{"RotateCmd":
{"FeatureCount": 1}}))
await dev.send_rotate_cmd({0: (1.0, True)})
assert client.last_message == RotateCmd(0, [RotateSubcommand(0, 1.0, True)])
@pytest.mark.asyncio
async def test_device_linear_single_argument():
client = DummyClient()
dev = ButtplugClientDevice(client, DeviceInfo("Test Rotation Device",
0,
{"LinearCmd":
{"FeatureCount": 1}}))
await dev.send_linear_cmd((1000, 1.0))
assert client.last_message == LinearCmd(0, [LinearSubcommand(0, 1000, 1.0)])
@pytest.mark.asyncio
async def test_device_linear_list():
client = DummyClient()
dev = ButtplugClientDevice(client, DeviceInfo("Test Rotation Device",
0,
{"LinearCmd":
{"FeatureCount": 1}}))
await dev.send_linear_cmd([(1000, 1.0)])
assert client.last_message == LinearCmd(0, [LinearSubcommand(0, 1000, 1.0)])
@pytest.mark.asyncio
async def test_device_linear_dict():
client = DummyClient()
dev = ButtplugClientDevice(client, DeviceInfo("Test Rotation Device",
0,
{"LinearCmd":
{"FeatureCount": 1}}))
await dev.send_linear_cmd({0: (1000, 1.0)})
assert client.last_message == LinearCmd(0, [LinearSubcommand(0, 1000, 1.0)])
| 42.271186
| 80
| 0.511828
| 428
| 4,988
| 5.808411
| 0.142523
| 0.014481
| 0.061545
| 0.079646
| 0.821802
| 0.821802
| 0.821802
| 0.821802
| 0.796862
| 0.791231
| 0
| 0.032598
| 0.391139
| 4,988
| 117
| 81
| 42.632479
| 0.785973
| 0
| 0
| 0.65625
| 0
| 0
| 0.077386
| 0
| 0
| 0
| 0
| 0
| 0.09375
| 1
| 0.010417
| false
| 0
| 0.052083
| 0
| 0.072917
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
023c62ffe1968741991a1389ca252e983c634d12
| 31,849
|
py
|
Python
|
user/views/user_view.py
|
dev-jochland/Employee-Management-System
|
e4a1e87b7bd9b72a2fa6eaf11293eaad50803ad8
|
[
"MIT"
] | null | null | null |
user/views/user_view.py
|
dev-jochland/Employee-Management-System
|
e4a1e87b7bd9b72a2fa6eaf11293eaad50803ad8
|
[
"MIT"
] | null | null | null |
user/views/user_view.py
|
dev-jochland/Employee-Management-System
|
e4a1e87b7bd9b72a2fa6eaf11293eaad50803ad8
|
[
"MIT"
] | null | null | null |
import re
from django.db import transaction, IntegrityError
from django.utils.translation import gettext_lazy as _
from rest_framework import status, viewsets
from rest_framework.decorators import action
from rest_framework.exceptions import ValidationError
from rest_framework.response import Response
import user.serializers.user_serializer as usu
from exception import get_all_serializer_errors
import permissions as pp
import user.utils as ut
import user.models as um
import user.tasks as task
valid_email_regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
class EmployerViewSet(viewsets.ViewSet):
@action(detail=False, methods=['post'], permission_classes=[pp.IsAdmin | pp.IsSuperAdmin])
def add_employee(self, request):
try:
if message := ut.validate_required_fields(
{
'full_name': request.data.get('full_name'),
'email': request.data.get('email'),
}
):
return Response(message, status=status.HTTP_400_BAD_REQUEST)
full_name = request.data.get('full_name')
if len(full_name.split(' ')) < 2 or len(full_name.split(' ')[1]) < 1:
return Response({'detail': _('Provide employee full name')}, status=status.HTTP_400_BAD_REQUEST)
if not re.fullmatch(valid_email_regex, request.data.get('email')):
return Response({'detail': _("Invalid email format")}, status=status.HTTP_400_BAD_REQUEST)
if um.Admin.objects.filter(user__email__iexact=request.data.get('email')):
return Response({'detail': _("Cannot add admin user")}, status=status.HTTP_400_BAD_REQUEST)
admin_email = ut.get_authenticated_email(request)
admin_user = um.AppUser.objects.get(email=admin_email)
admin_organisation = um.OrganisationAdmin.objects.get(admin__user__email=admin_email).organisation
if um.Employee.objects.filter(user__email__iexact=request.data.get('email'), is_deleted=False):
employee = um.Employee.objects.get(user__email__iexact=request.data.get('email'))
if um.EmployeeOrganisation.objects.filter(organisation=admin_organisation, employee=employee,
is_active=True, is_deleted=False):
return Response({'detail': _('User is already an employee in your organisation')},
status=status.HTTP_400_BAD_REQUEST)
elif um.EmployeeOrganisation.objects.filter(organisation=admin_organisation, employee=employee,
is_active=False, is_deleted=False):
return Response({'detail': _('Employee is inactive in your organisation, reactivate employee '
'instead')}, status=status.HTTP_400_BAD_REQUEST)
else:
wallet = um.Wallet.objects.create(created_by=employee.user.id)
um.EmployeeOrganisation.objects.create(employee=employee, organisation=admin_organisation,
wallet=wallet, created_by=employee.user.id)
um.ActivityLog.objects.create(activity_type='add_employee', created_by=admin_user.id,
is_organisation=True, user_affected=employee.user)
return Response({'detail': 'Employee added successfully.'},
status=status.HTTP_200_OK)
else:
with transaction.atomic():
user = um.AppUser.objects.create_user(email=request.data.get('email'), password='testpassword',
full_name=request.data.get('full_name'))
wallet = um.Wallet.objects.create(created_by=user.id)
employee = um.Employee.objects.create(user=user, created_by=user.id)
um.EmployeeOrganisation.objects.create(employee=employee, organisation=admin_organisation,
wallet=wallet, created_by=user.id)
um.ActivityLog.objects.create(activity_type='add_employee', created_by=admin_user.id,
is_organisation=True, user_affected=user)
return Response({'detail': 'Employee added successfully with default password: testpassword'},
status=status.HTTP_200_OK)
except IntegrityError:
return Response({'detail': _('Wallet Integrity Error')}, status=status.HTTP_400_BAD_REQUEST)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=False, permission_classes=[pp.IsAdmin | pp.IsSuperAdmin])
def dashboard(self, request):
try:
email = ut.get_authenticated_email(request)
organisation = um.OrganisationAdmin.objects.get(admin__user__email=email).organisation
admin = um.Admin.objects.get(user__email=email)
serializer = usu.OrganisationDashboardSerializer(organisation, context={'admin': admin})
return Response(serializer.data, status=status.HTTP_200_OK)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=False, methods=['post'], permission_classes=[pp.IsSuperAdmin])
def add_admin(self, request):
try:
if message := ut.validate_required_fields(
{
'full_name': request.data.get('full_name'),
'email': request.data.get('email'),
}
):
return Response(message, status=status.HTTP_400_BAD_REQUEST)
full_name = request.data.get('full_name')
if len(full_name.split(' ')) < 2 or len(full_name.split(' ')[1]) < 1:
return Response({'detail': _('Provide admin full name')}, status=status.HTTP_400_BAD_REQUEST)
if not re.fullmatch(valid_email_regex, request.data.get('email')):
return Response({'detail': _("Invalid email format")}, status=status.HTTP_400_BAD_REQUEST)
if um.AppUser.objects.filter(email__iexact=request.data.get('email')):
return Response({'detail': _("This email is already registered on the platform")},
status=status.HTTP_400_BAD_REQUEST)
super_admin_email = ut.get_authenticated_email(request)
super_admin_user = um.AppUser.objects.get(email=super_admin_email)
super_admin_organisation = um.OrganisationAdmin.objects.get(
admin__user__email=super_admin_email).organisation
with transaction.atomic():
user = um.AppUser.objects.create_user(email=request.data.get('email'), password='testpassword',
full_name=request.data.get('full_name'))
admin = um.Admin.objects.create(user=user, created_by=user.id)
um.OrganisationAdmin.objects.create(organisation=super_admin_organisation, admin=admin,
admin_type='admin', is_active=True, created_by=super_admin_user.id)
um.ActivityLog.objects.create(activity_type='add_admin', created_by=super_admin_user.id,
is_organisation=True, user_affected=user)
return Response({'detail': _('Admin added successfully with default password: testpassword')},
status=status.HTTP_200_OK)
except IntegrityError:
return Response({'detail': _('Wallet Integrity Error')}, status=status.HTTP_400_BAD_REQUEST)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=False, methods=['patch'], permission_classes=[pp.IsAdmin | pp.IsSuperAdmin])
def remove_employee(self, request):
try:
employee_email = request.data.get('employee_email')
if message := ut.validate_required_fields(
{
'employee_email': request.data.get('employee_email'),
}
):
return Response(message, status=status.HTTP_400_BAD_REQUEST)
admin_email = ut.get_authenticated_email(request)
admin_user = um.AppUser.objects.get(email=admin_email)
admin_organisation = um.OrganisationAdmin.objects.get(admin__user=admin_user).organisation
if not um.EmployeeOrganisation.objects.filter(organisation=admin_organisation,
employee__user__email=employee_email):
return Response({'detail': _('This employee is not part of this organisation')},
status=status.HTTP_400_BAD_REQUEST)
if um.EmployeeOrganisation.objects.filter(organisation=admin_organisation,
employee__user__email=employee_email, is_active=False):
return Response({'detail': _("Employee is already deactivated from organisation")},
status=status.HTTP_400_BAD_REQUEST)
employee = um.EmployeeOrganisation.objects.get(organisation=admin_organisation,
employee__user__email=employee_email, is_active=True)
employee.is_active = False
employee.save(update_fields=['is_active'])
# Create Organisation Activity Log
um.ActivityLog.objects.create(activity_type='remove_employee', created_by=admin_user.id,
user_affected=employee.employee.user, is_organisation=True)
return Response({'detail': _("Employee deactivated from organisation successfully")},
status=status.HTTP_200_OK)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=False, methods=['patch'], permission_classes=[pp.IsAdmin | pp.IsSuperAdmin])
def reactivate_employee(self, request):
try:
employee_email = request.data.get('employee_email')
if message := ut.validate_required_fields(
{
'employee_email': request.data.get('employee_email'),
}
):
return Response(message, status=status.HTTP_400_BAD_REQUEST)
admin_email = ut.get_authenticated_email(request)
admin_user = um.AppUser.objects.get(email=admin_email)
admin_organisation = um.OrganisationAdmin.objects.get(admin__user=admin_user).organisation
if not um.EmployeeOrganisation.objects.filter(organisation=admin_organisation,
employee__user__email=employee_email):
return Response({'detail': _('This employee is not part of this organisation')},
status=status.HTTP_400_BAD_REQUEST)
if um.EmployeeOrganisation.objects.filter(organisation=admin_organisation,
employee__user__email=employee_email, is_active=True):
return Response({'detail': _("Employee is already active in your organisation")},
status=status.HTTP_400_BAD_REQUEST)
employee = um.EmployeeOrganisation.objects.get(organisation=admin_organisation,
employee__user__email=employee_email, is_active=False)
employee.is_active = True
employee.save(update_fields=['is_active'])
# Create Organisation Activity Log
um.ActivityLog.objects.create(activity_type='re_activated_employee', created_by=admin_user.id,
user_affected=employee.employee.user, is_organisation=True)
return Response({'detail': _("Employee reactivated to organisation successfully")},
status=status.HTTP_200_OK)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=False, methods=['patch'], permission_classes=[pp.IsSuperAdmin])
def remove_admin(self, request):
try:
admin_email = request.data.get('admin_email')
if message := ut.validate_required_fields(
{
'admin_email': request.data.get('admin_email'),
}
):
return Response(message, status=status.HTTP_400_BAD_REQUEST)
super_admin_email = ut.get_authenticated_email(request)
super_admin_user = um.AppUser.objects.get(email=super_admin_email)
admin_organisation = um.OrganisationAdmin.objects.get(admin__user=super_admin_user).organisation
if super_admin_email == admin_email.lower():
return Response({'detail': _("Super admin can\'t remove itself, contact product administrator.")},
status=status.HTTP_400_BAD_REQUEST)
if not um.OrganisationAdmin.objects.filter(organisation=admin_organisation,
admin__user__email=admin_email):
return Response({'detail': _('This admin is not part of this organisation')},
status=status.HTTP_400_BAD_REQUEST)
if um.OrganisationAdmin.objects.filter(organisation=admin_organisation,
admin__user__email=admin_email, is_disabled=True):
return Response({'detail': _("Admin already removed from organisation")},
status=status.HTTP_400_BAD_REQUEST)
admin = um.OrganisationAdmin.objects.get(organisation=admin_organisation,
admin__user__email=admin_email, is_disabled=False)
admin.is_disabled = True
admin.save(update_fields=['is_disabled'])
# Create Organisation Activity Log
um.ActivityLog.objects.create(activity_type='remove_admin', created_by=super_admin_user.id,
user_affected=admin.admin.user, is_organisation=True)
return Response({'detail': _("Admin removed from organisation successfully")},
status=status.HTTP_200_OK)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=False, permission_classes=[pp.IsSuperAdmin], url_path='admins', url_name='admins')
def get_all_admins(self, request):
try:
email = ut.get_authenticated_email(request)
super_admin_organisation = um.OrganisationAdmin.objects.get(admin__user__email=email,
admin_type='super_admin').organisation
organisation_admins = um.OrganisationAdmin.objects.filter(organisation=super_admin_organisation,
admin_type='admin')
serializer = usu.OrganisationAdminSerializer(organisation_admins, many=True)
return Response(serializer.data, status=status.HTTP_200_OK)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=True, methods=['patch'], permission_classes=[pp.IsSuperAdmin | pp.IsAdmin], url_path='profile',
url_name='profile')
def update_profile(self, request, pk=None):
try:
organisation_id = self.kwargs.get('pk')
if not um.Organisation.objects.filter(id=organisation_id, is_deleted=False):
return Response({'detail': _("Organisation does not exist")}, status=status.HTTP_400_BAD_REQUEST)
email = ut.get_authenticated_email(request)
if not um.OrganisationAdmin.objects.filter(organisation_id=organisation_id, admin__user__email=email):
return Response({'detail': _('You don not have access to this organisation')},
status=status.HTTP_403_FORBIDDEN)
organisation = um.Organisation.objects.get(id=organisation_id)
serializer = usu.UpdateOrganisationSerializer(organisation, data=request.data, partial=True)
serializer.is_valid(raise_exception=True)
serializer.save()
return Response(serializer.data, status=status.HTTP_200_OK)
except ValidationError as e:
error = get_all_serializer_errors(e)
return Response(error, status=status.HTTP_400_BAD_REQUEST)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=False, methods=['post'], permission_classes=[pp.IsSuperAdmin | pp.IsAdmin])
def pay_employee(self, request):
try:
if message := ut.validate_required_fields(
{
'employee_wallet': request.data.get('employee_wallet'),
'employee_email': request.data.get('employee_email'),
"amount": request.data.get('amount'),
"pin": request.data.get('pin'),
'description': request.data.get('description'),
}
):
return Response(message, status=status.HTTP_400_BAD_REQUEST)
email = ut.get_authenticated_email(request)
admin_user = um.AppUser.objects.get(email=email)
organisation = um.OrganisationAdmin.objects.get(admin__user=admin_user).organisation
# sanitise employee data
verify_employee_data = ut.verify_employee_data(request.data.get('amount'),
request.data.get('employee_wallet'),
request.data.get('employee_email'), organisation)
if type(verify_employee_data) is dict:
return Response(verify_employee_data, status=status.HTTP_400_BAD_REQUEST)
if organisation.wallet.pin is None:
return Response({'detail': 'Set wallet pin before making payment'}, status=status.HTTP_400_BAD_REQUEST)
verify_pin = ut.verify_wallet_pin(organisation.wallet, str(request.data.get('pin')))
if not verify_pin:
return Response({'detail': _('Incorrect wallet pin provided')}, status=status.HTTP_400_BAD_REQUEST)
balance = ut.get_wallet_balance(organisation.wallet)
cleaned_amount = verify_employee_data
if cleaned_amount > balance:
return Response({'detail': _('Insufficient funds in wallet')}, status=status.HTTP_400_BAD_REQUEST)
# Push payment to celery queue
task.make_employee_payment.delay(request.data.get('employee_wallet'), request.data.get('description'),
admin_user, organisation, cleaned_amount)
return Response({'detail': _("Payment successfully made to employee")}, status=status.HTTP_200_OK)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=False, methods=['post'], permission_classes=[pp.IsSuperAdmin | pp.IsAdmin])
def bulk_pay_employees(self, request):
try:
if message := ut.validate_required_fields(
{
"employees": request.data.get('employees'),
"pin": request.data.get('pin'),
'description': request.data.get('description'),
}
):
return Response(message, status=status.HTTP_400_BAD_REQUEST)
email = ut.get_authenticated_email(request)
admin_user = um.AppUser.objects.get(email=email)
organisation = um.OrganisationAdmin.objects.get(admin__user=admin_user).organisation
# Sanitise provided data
verify_data = ut.verify_bulk_employee_data(request.data.get('employees'), organisation)
if type(verify_data) is dict:
return Response(verify_data, status=status.HTTP_400_BAD_REQUEST)
if organisation.wallet.pin is None:
return Response({'detail': 'Set wallet pin before making payment'}, status=status.HTTP_400_BAD_REQUEST)
verify_pin = ut.verify_wallet_pin(organisation.wallet, str(request.data.get('pin')))
if not verify_pin:
return Response({'detail': _('Incorrect wallet pin provided')}, status=status.HTTP_400_BAD_REQUEST)
balance = ut.get_wallet_balance(organisation.wallet)
cleaned_total_amount = verify_data
if cleaned_total_amount > balance:
return Response({'detail': _('Insufficient funds in wallet')}, status=status.HTTP_400_BAD_REQUEST)
# push payment to celery queue
task.make_bulk_payment.delay(request.data.get('employees'), request.data.get('description'), admin_user,
organisation)
return Response({'detail': "Bulk payment made successfully"}, status=status.HTTP_200_OK)
except Exception as e:
return Response({'detail': str(e)}, status=status.HTTP_400_BAD_REQUEST)
class WalletViewSet(viewsets.ViewSet):
@action(detail=False, methods=['patch'], permission_classes=[pp.IsSuperAdmin | pp.IsEmployee])
def set_pin(self, request):
try:
if message := ut.validate_required_fields(
{
'organisation_id': request.data.get('organisation_id'),
'wallet_address': request.data.get('wallet_address'),
'new_pin': request.data.get('new_pin'),
'confirm_new_pin': request.data.get('confirm_new_pin'),
}
):
return Response(message, status=status.HTTP_400_BAD_REQUEST)
organisation_id = request.data.get('organisation_id')
wallet_address = request.data.get('wallet_address')
new_pin = request.data.get('new_pin')
confirm_new_pin = request.data.get('confirm_new_pin')
if not str(new_pin).isdigit():
return Response({'detail': _("New Pin must be numbers only")}, status=status.HTTP_400_BAD_REQUEST)
if not str(confirm_new_pin).isdigit():
return Response({'detail': _("Confirm New Pin must be numbers only")},
status=status.HTTP_400_BAD_REQUEST)
email = ut.get_authenticated_email(request)
user = um.AppUser.objects.get(email=email)
if um.Admin.objects.filter(user__email=email):
if not um.OrganisationAdmin.objects.filter(organisation_id=organisation_id, admin__user__email=email):
return Response({'detail': _('You do not have access to this organisation')},
status=status.HTTP_403_FORBIDDEN)
wallet = um.Organisation.objects.get(id=organisation_id, wallet__address=wallet_address,
is_deleted=False).wallet
setup_pin = ut.set_pin_util(usu.WalletPinSerializer, wallet, request, new_pin, user, True)
return Response(setup_pin.data, status=setup_pin.status_code)
elif um.EmployeeOrganisation.objects.filter(organisation_id=organisation_id, employee__user__email=email):
wallet = um.EmployeeOrganisation.objects.get(organisation_id=organisation_id,
employee__user__email=email,
wallet__address=wallet_address).wallet
setup_pin = ut.set_pin_util(usu.WalletPinSerializer, wallet, request, new_pin, user, False)
return Response(setup_pin.data, status=setup_pin.status_code)
return Response({'detail': _('Invalid user')}, status=status.HTTP_400_BAD_REQUEST)
except ValidationError as e:
error = get_all_serializer_errors(e)
return Response(error, status=status.HTTP_400_BAD_REQUEST)
except um.Organisation.DoesNotExist:
return Response({'detail': _('Your organisation does not have access to this wallet')},
status=status.HTTP_400_BAD_REQUEST)
except um.EmployeeOrganisation.DoesNotExist:
return Response({'detail': _('You are not the owner of this wallet or the wallet is not tied to the '
'provided employee organisation')}, status=status.HTTP_400_BAD_REQUEST)
except um.AppUser.DoesNotExist:
return Response({'detail': _('User does not exist')}, status=status.HTTP_400_BAD_REQUEST)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=False, methods=['patch'], permission_classes=[pp.IsSuperAdmin | pp.IsEmployee])
def change_pin(self, request):
try:
if message := ut.validate_required_fields(
{
'organisation_id': request.data.get('organisation_id'),
'wallet_address': request.data.get('wallet_address'),
'new_pin': request.data.get('new_pin'),
'confirm_new_pin': request.data.get('confirm_new_pin'),
'old_pin': request.data.get('old_pin')
}
):
return Response(message, status=status.HTTP_400_BAD_REQUEST)
organisation_id = request.data.get('organisation_id')
wallet_address = request.data.get('wallet_address')
new_pin = request.data.get('new_pin')
confirm_new_pin = request.data.get('confirm_new_pin')
old_pin = request.data.get('old_pin')
if not str(new_pin).isdigit():
return Response({'detail': _("New Pin must be numbers only")}, status=status.HTTP_400_BAD_REQUEST)
if not str(confirm_new_pin).isdigit():
return Response({'detail': _("Confirm New Pin must be numbers only")},
status=status.HTTP_400_BAD_REQUEST)
email = ut.get_authenticated_email(request)
user = um.AppUser.objects.get(email=email)
if um.Admin.objects.filter(user__email=email):
if not um.OrganisationAdmin.objects.filter(organisation_id=organisation_id, admin__user__email=email):
return Response({'detail': _('You do not have access to this organisation')},
status=status.HTTP_403_FORBIDDEN)
wallet = um.Organisation.objects.get(id=organisation_id, wallet__address=wallet_address,
is_deleted=False).wallet
change_pin = ut.change_pin_util(usu.WalletPinSerializer, wallet, request, new_pin, old_pin, user, True)
return Response(change_pin.data, status=change_pin.status_code)
elif um.EmployeeOrganisation.objects.filter(organisation_id=organisation_id, employee__user__email=email):
wallet = um.EmployeeOrganisation.objects.get(organisation_id=organisation_id,
employee__user__email=email,
wallet__address=wallet_address).wallet
change_pin = ut.change_pin_util(usu.WalletPinSerializer, wallet, request, new_pin, old_pin, user, False)
return Response(change_pin.data, status=change_pin.status_code)
# for when an employee provides invalid organisation id
return Response({'detail': _('You are not part of this organisation')}, status=status.HTTP_400_BAD_REQUEST)
except ValidationError as e:
error = get_all_serializer_errors(e)
return Response(error, status=status.HTTP_400_BAD_REQUEST)
except um.Organisation.DoesNotExist:
return Response({'detail': _('Your organisation does not have access to this wallet')},
status=status.HTTP_400_BAD_REQUEST)
except um.EmployeeOrganisation.DoesNotExist:
return Response({'detail': _('You are not the owner of this wallet or the wallet is not tied to the '
'provided employee organisation')}, status=status.HTTP_400_BAD_REQUEST)
except um.AppUser.DoesNotExist:
return Response({'detail': _('User does not exist')}, status=status.HTTP_400_BAD_REQUEST)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
class EmployeeViewSet(viewsets.ModelViewSet):
@action(detail=False, permission_classes=[pp.IsEmployee])
def dashboard(self, request):
try:
email = ut.get_authenticated_email(request)
employee = um.Employee.objects.get(user__email=email)
serializer = usu.EmployeeDashboardSerializer(employee)
return Response(serializer.data, status=status.HTTP_200_OK)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
@action(detail=True, methods=['patch'], permission_classes=[pp.IsEmployee], url_path='profile', url_name='profile')
def update_profile(self, request, pk=None):
try:
employee_id = self.kwargs.get('pk')
if not um.Employee.objects.filter(id=employee_id, is_deleted=False):
return Response({'detail': _('Employee does not exist')}, status=status.HTTP_400_BAD_REQUEST)
email = ut.get_authenticated_email(request)
if not um.Employee.objects.filter(user__email=email, id=employee_id):
return Response({'detail': "You can't make update for this employee"}, status=status.HTTP_403_FORBIDDEN)
employee = um.Employee.objects.get(id=employee_id)
full_name = request.data.get('full_name')
if full_name is not None:
if len(full_name.split(' ')) < 2 or len(full_name.split(' ')[1]) < 1:
return Response({'detail': _('Provide employee full name')}, status=status.HTTP_400_BAD_REQUEST)
serializer = usu.EmployeeSerializer(employee, data=request.data, partial=True)
serializer.is_valid(raise_exception=True)
if full_name is not None:
employee.user.full_name = full_name
employee.user.save()
serializer.save()
return Response(serializer.data, status=status.HTTP_200_OK)
except ValidationError as e:
error = get_all_serializer_errors(e)
return Response(error, status=status.HTTP_400_BAD_REQUEST)
except Exception as e:
return Response({'detail': _(str(e))}, status=status.HTTP_400_BAD_REQUEST)
| 64.211694
| 120
| 0.611291
| 3,379
| 31,849
| 5.504587
| 0.069251
| 0.066237
| 0.072258
| 0.068441
| 0.874946
| 0.851828
| 0.82543
| 0.780538
| 0.764731
| 0.737849
| 0
| 0.01182
| 0.293384
| 31,849
| 495
| 121
| 64.341414
| 0.814663
| 0.008038
| 0
| 0.625277
| 0
| 0.002217
| 0.110467
| 0.00228
| 0
| 0
| 0
| 0
| 0
| 1
| 0.031042
| false
| 0.008869
| 0.028825
| 0
| 0.261641
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
5a115d2b6501f5da6415c49552e4ed0c6f4d1002
| 147
|
py
|
Python
|
src/main/calc_02.py
|
Hacksbr/cov-test
|
7ccf209e7f996c5281edba5ab2ad250e3004cb16
|
[
"MIT"
] | null | null | null |
src/main/calc_02.py
|
Hacksbr/cov-test
|
7ccf209e7f996c5281edba5ab2ad250e3004cb16
|
[
"MIT"
] | 4
|
2021-03-18T04:35:57.000Z
|
2021-03-28T03:08:54.000Z
|
src/main/calc_02.py
|
Hacksbr/cov-test
|
7ccf209e7f996c5281edba5ab2ad250e3004cb16
|
[
"MIT"
] | null | null | null |
def division(a, b):
return a / b
def multiplication(a, b):
return a * b
def multiplication_2(a, b, c, d):
return (a * b) + (c - d)
| 13.363636
| 33
| 0.55102
| 26
| 147
| 3.076923
| 0.346154
| 0.15
| 0.3
| 0.225
| 0.675
| 0.675
| 0.675
| 0
| 0
| 0
| 0
| 0.009615
| 0.292517
| 147
| 10
| 34
| 14.7
| 0.759615
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 6
|
5a8267f44e7d70da005c251a162009914468054f
| 62
|
py
|
Python
|
tests/cases/stats/tests/__init__.py
|
rysdyk/avocado
|
655c1a766be616cb1357ddff8bc345ab61ae9e8a
|
[
"BSD-2-Clause"
] | null | null | null |
tests/cases/stats/tests/__init__.py
|
rysdyk/avocado
|
655c1a766be616cb1357ddff8bc345ab61ae9e8a
|
[
"BSD-2-Clause"
] | null | null | null |
tests/cases/stats/tests/__init__.py
|
rysdyk/avocado
|
655c1a766be616cb1357ddff8bc345ab61ae9e8a
|
[
"BSD-2-Clause"
] | 2
|
2020-01-13T20:40:09.000Z
|
2020-01-16T15:26:11.000Z
|
from .agg import * # noqa
from .kmeans import * # noqa
| 20.666667
| 30
| 0.596774
| 8
| 62
| 4.625
| 0.625
| 0.540541
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.306452
| 62
| 2
| 31
| 31
| 0.860465
| 0.145161
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
ce68caea4fae514f0ff102ba465fb387e547f3b6
| 76
|
py
|
Python
|
src/ormar_postgres_extensions/fields/__init__.py
|
tophat/ormar-postgres-extensions
|
88fcab5a73bc89090739c38f063191d8473957a5
|
[
"Apache-2.0"
] | 6
|
2021-08-02T22:24:34.000Z
|
2022-03-21T08:59:22.000Z
|
src/ormar_postgres_extensions/fields/__init__.py
|
tophat/ormar-postgres-extensions
|
88fcab5a73bc89090739c38f063191d8473957a5
|
[
"Apache-2.0"
] | 14
|
2021-08-03T00:03:55.000Z
|
2022-02-17T02:10:08.000Z
|
src/ormar_postgres_extensions/fields/__init__.py
|
tophat/ormar-postgres-extensions
|
88fcab5a73bc89090739c38f063191d8473957a5
|
[
"Apache-2.0"
] | 2
|
2022-01-28T20:10:12.000Z
|
2022-02-09T16:49:01.000Z
|
from .jsonb import JSONB # noqa: F401
from .uuid import UUID # noqa: F401
| 25.333333
| 38
| 0.710526
| 12
| 76
| 4.5
| 0.5
| 0.296296
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 0.210526
| 76
| 2
| 39
| 38
| 0.8
| 0.276316
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
ce7a0dbe0c15954c52ab3929af28c57db4ce39ea
| 3,665
|
py
|
Python
|
cinder/tests/unit/image/test_accelerator.py
|
lightsey/cinder
|
e03d68e42e57a63f8d0f3e177fb4287290612b24
|
[
"Apache-2.0"
] | 3
|
2015-04-02T21:44:36.000Z
|
2016-04-29T21:19:04.000Z
|
cinder/tests/unit/image/test_accelerator.py
|
lightsey/cinder
|
e03d68e42e57a63f8d0f3e177fb4287290612b24
|
[
"Apache-2.0"
] | 3
|
2016-04-29T21:45:26.000Z
|
2016-05-04T19:41:23.000Z
|
cinder/tests/unit/image/test_accelerator.py
|
lightsey/cinder
|
e03d68e42e57a63f8d0f3e177fb4287290612b24
|
[
"Apache-2.0"
] | 4
|
2016-01-27T00:25:52.000Z
|
2021-03-25T19:54:08.000Z
|
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from cinder.image import accelerator
from cinder import test
class fakeEngine(object):
def __init__(self):
pass
def compress_img(self, src, dest, run_as_root):
pass
def decompress_img(self, src, dest, run_as_root):
pass
class TestAccelerator(test.TestCase):
@mock.patch('cinder.image.accelerator.ImageAccel._get_engine')
@mock.patch('cinder.image.accelerator.ImageAccel.is_engine_ready',
return_value = True)
def test_compress_img_engine_ready(self, mock_accel_engine_ready,
mock_get_engine):
source = mock.sentinel.source
dest = mock.sentinel.dest
run_as_root = mock.sentinel.run_as_root
mock_engine = mock.Mock(spec=fakeEngine)
mock_get_engine.return_value = mock_engine
accel = accelerator.ImageAccel(source, dest)
accel.compress_img(run_as_root=run_as_root)
mock_engine.compress_img.assert_called()
@mock.patch('cinder.image.accelerator.ImageAccel._get_engine')
@mock.patch('cinder.image.accelerator.ImageAccel.is_engine_ready',
return_value = False)
def test_compress_img_engine_not_ready(self, mock_accel_engine_ready,
mock_get_engine):
source = mock.sentinel.source
dest = mock.sentinel.dest
run_as_root = mock.sentinel.run_as_root
mock_engine = mock.Mock(spec=fakeEngine)
mock_get_engine.return_value = mock_engine
accel = accelerator.ImageAccel(source, dest)
accel.compress_img(run_as_root=run_as_root)
mock_engine.compress_img.assert_not_called()
@mock.patch('cinder.image.accelerator.ImageAccel._get_engine')
@mock.patch('cinder.image.accelerator.ImageAccel.is_engine_ready',
return_value = True)
def test_decompress_img_engine_ready(self, mock_accel_engine_ready,
mock_get_engine):
source = mock.sentinel.source
dest = mock.sentinel.dest
run_as_root = mock.sentinel.run_as_root
mock_engine = mock.Mock(spec=fakeEngine)
mock_get_engine.return_value = mock_engine
accel = accelerator.ImageAccel(source, dest)
accel.decompress_img(run_as_root=run_as_root)
mock_engine.decompress_img.assert_called()
@mock.patch('cinder.image.accelerator.ImageAccel._get_engine')
@mock.patch('cinder.image.accelerator.ImageAccel.is_engine_ready',
return_value = False)
def test_decompress_img_engine_not_ready(self, mock_accel_engine_ready,
mock_get_engine):
source = mock.sentinel.source
dest = mock.sentinel.dest
run_as_root = mock.sentinel.run_as_root
mock_engine = mock.Mock(spec=fakeEngine)
mock_get_engine.return_value = mock_engine
accel = accelerator.ImageAccel(source, dest)
accel.decompress_img(run_as_root=run_as_root)
mock_engine.decompress_img.assert_not_called()
| 36.287129
| 78
| 0.685402
| 466
| 3,665
| 5.094421
| 0.2103
| 0.037911
| 0.068239
| 0.065712
| 0.749789
| 0.734625
| 0.734625
| 0.734625
| 0.711879
| 0.711879
| 0
| 0.001431
| 0.237381
| 3,665
| 100
| 79
| 36.65
| 0.847943
| 0.148977
| 0
| 0.746032
| 0
| 0
| 0.126329
| 0.126329
| 0
| 0
| 0
| 0
| 0.063492
| 1
| 0.111111
| false
| 0.047619
| 0.047619
| 0
| 0.190476
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
ce9eebf58160a5f34dd05a336888ec51ae036a3e
| 28
|
py
|
Python
|
strategies/ewc/__init__.py
|
rmassidda/reproducible-continual-learning
|
ed7b7db634038d9d4312c2c54b15ca8eead1c07c
|
[
"MIT"
] | 53
|
2021-04-20T15:41:23.000Z
|
2022-03-30T17:24:36.000Z
|
strategies/ewc/__init__.py
|
rmassidda/reproducible-continual-learning
|
ed7b7db634038d9d4312c2c54b15ca8eead1c07c
|
[
"MIT"
] | 14
|
2021-10-08T10:35:31.000Z
|
2022-03-29T14:00:06.000Z
|
strategies/ewc/__init__.py
|
rmassidda/reproducible-continual-learning
|
ed7b7db634038d9d4312c2c54b15ca8eead1c07c
|
[
"MIT"
] | 7
|
2021-11-02T15:39:57.000Z
|
2022-03-31T03:25:04.000Z
|
from .experiment import EWC
| 14
| 27
| 0.821429
| 4
| 28
| 5.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 28
| 1
| 28
| 28
| 0.958333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
cebc6ace5fd9f287df685bc8f3b3d7e6f07341f5
| 154
|
py
|
Python
|
blockformer/builder.py
|
colinski/blockformer
|
56be6abc08dc25ab97c526384e9c69f6c814c3ed
|
[
"MIT"
] | null | null | null |
blockformer/builder.py
|
colinski/blockformer
|
56be6abc08dc25ab97c526384e9c69f6c814c3ed
|
[
"MIT"
] | null | null | null |
blockformer/builder.py
|
colinski/blockformer
|
56be6abc08dc25ab97c526384e9c69f6c814c3ed
|
[
"MIT"
] | null | null | null |
from mmcv import build_from_cfg
from mmcv.utils import Registry
BLOCKS = Registry('block')
def build_block(cfg):
return build_from_cfg(cfg, BLOCKS)
| 19.25
| 38
| 0.779221
| 24
| 154
| 4.791667
| 0.458333
| 0.13913
| 0.208696
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 154
| 7
| 39
| 22
| 0.871212
| 0
| 0
| 0
| 0
| 0
| 0.032468
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0.2
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 6
|
ced4e990d301bf48d3657f71c147ece973d5d950
| 44
|
py
|
Python
|
tatk/nlu/svm/camrest/__init__.py
|
yqzhangthu/tatk
|
4d27e89604a33f19f1c7b8fe5dc92d4ba6c6f10a
|
[
"Apache-2.0"
] | 81
|
2019-03-12T13:40:29.000Z
|
2022-01-17T10:59:21.000Z
|
tatk/nlu/svm/camrest/__init__.py
|
zqwerty/tatk
|
fafabc45d02ad889f59354acac4e3b1367e7d4bf
|
[
"Apache-2.0"
] | 35
|
2019-03-13T14:05:05.000Z
|
2021-08-25T15:38:14.000Z
|
tatk/nlu/svm/camrest/__init__.py
|
zqwerty/tatk
|
fafabc45d02ad889f59354acac4e3b1367e7d4bf
|
[
"Apache-2.0"
] | 41
|
2019-03-13T09:40:24.000Z
|
2022-03-07T17:59:07.000Z
|
from tatk.nlu.svm.camrest.nlu import SVMNLU
| 22
| 43
| 0.818182
| 8
| 44
| 4.5
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 44
| 1
| 44
| 44
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
0c71aa95bdd236c8fb5f4699996ad1bf9dfed915
| 286
|
py
|
Python
|
CIFAR10/models/__init__.py
|
UBCDingXin/DDRE_Sampling_GANs
|
72ec41f8a0913a72ed7cf2c57ded1c65c6fe6823
|
[
"MIT"
] | 2
|
2019-11-17T15:14:19.000Z
|
2020-06-13T18:02:37.000Z
|
CIFAR10/models/__init__.py
|
UBCDingXin/DDRE_Sampling_GANs
|
72ec41f8a0913a72ed7cf2c57ded1c65c6fe6823
|
[
"MIT"
] | 1
|
2021-11-20T13:11:37.000Z
|
2021-11-21T04:28:43.000Z
|
CIFAR10/models/__init__.py
|
UBCDingXin/DDRE_Sampling_GANs
|
72ec41f8a0913a72ed7cf2c57ded1c65c6fe6823
|
[
"MIT"
] | 1
|
2021-07-06T04:53:47.000Z
|
2021-07-06T04:53:47.000Z
|
from .InceptionV3 import *
from .ResNet import *
from .DR_MLP import *
from .DR_ResNet import *
from .DR_VGG import *
from .cnn_generator_discriminator import *
from .MMDGAN import *
from .Binary_Classifier import *
from .DR_2layersCNN import *
from .DR_6layersCNN import *
| 23.833333
| 43
| 0.748252
| 38
| 286
| 5.421053
| 0.394737
| 0.436893
| 0.291262
| 0.174757
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012821
| 0.181818
| 286
| 11
| 44
| 26
| 0.867521
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
0c8b6e5676fa79e39ce5ea05e934593c8aa1470f
| 8,624
|
py
|
Python
|
evo.py
|
empyriumz/Entanglement-Dynamics
|
433228042517000ae3bf2a5105b36f82272170fa
|
[
"MIT"
] | 5
|
2020-04-08T19:10:11.000Z
|
2022-03-22T14:54:27.000Z
|
evo.py
|
empyriumz/Entanglement-Dynamics
|
433228042517000ae3bf2a5105b36f82272170fa
|
[
"MIT"
] | 1
|
2020-05-13T02:25:33.000Z
|
2020-05-19T15:32:47.000Z
|
evo.py
|
empyriumz/Entanglement-Dynamics
|
433228042517000ae3bf2a5105b36f82272170fa
|
[
"MIT"
] | 5
|
2019-12-02T19:31:10.000Z
|
2021-11-17T19:13:48.000Z
|
from circuit_dynamics_init import *
from pybind_circuit import unitary_cxx_parallel, unitary_cxx, unitary_conventional_cxx
from timeit import default_timer as timer
# reading parameters from file
para = open('para_haar.txt', 'r')
para = para.readlines()
# the paramters are system size, measurement probability and discrete time steps
L, pro, time = int(para[0]), float(para[1]), int(para[2])
# system partition
# with PBC, we partition system into 4 parts where a and b separated by c1 and c2
# c1 and c2 are effectively connected, so the system is composed of A, B and C
lc1, la, lb = int(np.floor(L/8)), int(np.floor(L/4)), int(np.floor(L/4))
lc2 = L-lc1-la-lb
# pack the partition into array
part= np.array([L, la, lb, lc1, lc2], dtype="int64")
# initializing wavefunctions
p1 = np.ones(1)
p2 = np.zeros(2**L-1,dtype='c16')
# a product state with all spins align up
psi = np.concatenate((p1,p2),axis=0).T
# pure python version of evolution
# suitable for small size L<=18
def evo(steps, wave, prob, k = 4, l = L, n = 2, partition = part):
von = np.zeros(steps, dtype='float64') # von-Neumann entropy
renyi = np.zeros(steps, dtype='float64') # Renyi entropy
neg = np.zeros(steps, dtype='float64') # logarithmic negativity
mut = np.zeros(steps, dtype='float64') # mutual information using von-Neumann entropy
mutr = np.zeros(steps, dtype='float64') # mutual information in terms of Renyi entropy
for t in range(steps):
# evolve over All links
wave = unitary(wave, k, l)
# measurement layer
'''
with this protocol, we need to double the measurement rate
'''
for j in range(l):
wave = measure(wave, prob, j, l)
result = ent(wave, n, l//2, l) # half-chain entanglement entropy
von[t] = result[0]
renyi[t] = result[1]
result = logneg(wave, n, partition)
neg[t] = result[0]
mut[t] = result[1]
mutr[t] = result[2]
return np.array([von, renyi, neg , mut, mutr])
# pure python version with original evolution scheme
def evo_original(steps, wave, prob, l = L, n = 2, partition = part):
von = np.zeros(steps, dtype='float64') # von-Neumann entropy
renyi = np.zeros(steps, dtype='float64') # Renyi entropy
neg = np.zeros(steps, dtype='float64') # logarithmic negativity
mut = np.zeros(steps, dtype='float64') # mutual information using von-Neumann entropy
mutr = np.zeros(steps, dtype='float64') # mutual information in terms of Renyi entropy
for t in range(steps):
# evolve over odd links
for i in range(l//2):
wave = unitary_conventional(wave, i, l)
# measurement layer
for i in range(l):
wave = measure(wave, prob, i, l)
# before evolve on even link, we need to rearrange indices first to accommodate the boundary condition PBC
wave = np.reshape(wave,(2, 2**(l-2),2))
# move the last site into the first one such that the unitaries can connect the 1st and the last site
wave = np.moveaxis(wave,-1,0)
wave = wave.flatten()
# evolve over even links
for i in range(l//2):
wave = unitary_conventional(wave, i, l)
#shift the index back to the original order after evolution
wave = np.reshape(wave,(2, 2, 2**(l-2)))
wave = np.moveaxis(wave,-1,0)
wave = np.moveaxis(wave,-1,0).flatten()
#measurement layer
for i in range(l):
wave = measure(wave, prob, i, l)
result = ent(wave, n, l//2, l)
von[t] = result[0]
renyi[t] = result[1]
result = logneg(wave, n, partition)
neg[t] = result[0]
mut[t] = result[1]
mutr[t] = result[2]
return np.array([von, renyi, neg , mut, mutr])
# replacing dot product with c++ version of evolution
# slowest option
def evo_cxx(steps, wave, prob, k = 4, l = L, n = 2, partition = part):
von = np.zeros(steps, dtype='float64') # von-Neumann entropy
renyi = np.zeros(steps, dtype='float64') # Renyi entropy
neg = np.zeros(steps, dtype='float64') # logarithmic negativity
mut = np.zeros(steps, dtype='float64') # mutual information using von-Neumann entropy
mutr = np.zeros(steps, dtype='float64') # mutual information in terms of Renyi entropy
'''
only the splitted dot product is replaced by c++ module
'''
for t in range(steps):
# evolve over All links
wave = unitary_cxx(wave, k, l)
# measurement layer
'''
with this protocol, we need to double the measurement rate
'''
for j in range(l):
wave = measure(wave, prob, j, l)
result = ent_approx(wave, n, l, l//2) # half-chain entanglement entropy
von[t] = result[0]
renyi[t] = result[1]
result = logneg(wave, n, partition)
neg[t] = result[0]
mut[t] = result[1]
mutr[t] = result[2]
return np.array([von, renyi, neg , mut, mutr])
# replacing dot product with c++
def evo_original_cxx(steps, wave, prob, l = L, n = 2, partition = part):
von = np.zeros(steps, dtype='float64') # von-Neumann entropy
renyi = np.zeros(steps, dtype='float64') # Renyi entropy
neg = np.zeros(steps, dtype='float64') # logarithmic negativity
mut = np.zeros(steps, dtype='float64') # mutual information using von-Neumann entropy
mutr = np.zeros(steps, dtype='float64') # mutual information in terms of Renyi entropy
for t in range(steps):
# evolve over odd links
for i in range(l//2):
wave = unitary_conventional_cxx(wave, i, l)
# measurement layer
for i in range(l):
wave = measure(wave, prob, i, l)
# before evolve on even link, we need to rearrange indices first to accommodate the boundary condition PBC
wave = np.reshape(wave,(2, 2**(l-2),2))
# move the last site into the first one such that the unitaries can connect the 1st and the last site
wave = np.moveaxis(wave,-1,0)
wave = wave.flatten()
# evolve over even links
for i in range(l//2):
wave = unitary_conventional_cxx(wave, i, l)
#shift the index back to the original order after evolution
wave = np.reshape(wave,(2, 2, 2**(l-2)))
wave = np.moveaxis(wave,-1,0)
wave = np.moveaxis(wave,-1,0).flatten()
#measurement layer
for i in range(l):
wave = measure(wave, prob, i, l)
result = ent(wave, n, l//2, l)
von[t] = result[0]
renyi[t] = result[1]
result = logneg(wave, n, partition)
neg[t] = result[0]
mut[t] = result[1]
mutr[t] = result[2]
return np.array([von, renyi, neg , mut, mutr])
# c++ binding accelerated unitary evolution
def evo_parallel(steps, wave, prob, k = 4, l = L, n = 2, partition = part):
von = np.zeros(steps, dtype='float64') # von-Neumann entropy
renyi = np.zeros(steps, dtype='float64') # Renyi entropy
neg = np.zeros(steps, dtype='float64') # logarithmic negativity
mut = np.zeros(steps, dtype='float64') # mutual information using von-Neumann entropy
mutr = np.zeros(steps, dtype='float64') # mutual information in terms of Renyi entropy
for t in range(steps):
# evolve over All links
wave = unitary_cxx_parallel(wave, k, l)
# measurement layer
'''
with this protocol, we need to double the measurement rate
'''
for j in range(l):
wave = measure(wave, prob, j, l)
result = ent(wave, n, l//2, l) # half-chain entanglement entropy
von[t] = result[0]
renyi[t] = result[1]
result = logneg(wave, n, partition)
neg[t] = result[0]
mut[t] = result[1]
mutr[t] = result[2]
return np.array([von, renyi, neg , mut, mutr])
# benchmark for different evolution schemes
# start = timer()
# result = evo_original(time, psi, pro)
# end = timer()
# print("Elapsed = %s" % (end - start))
start = timer()
result = evo_original_cxx(time, psi, pro)
end = timer()
print("Elapsed = %s" % (end - start))
start = timer()
result = evo_parallel(time, psi, 2*pro, 6)
end = timer()
print("Elapsed = %s" % (end - start))
start = timer()
result = evo_parallel(time, psi, 2*pro, 4)
end = timer()
print("Elapsed = %s" % (end - start))
np.savez('dynamics_L=%s_p=%s_t=%s'%(L, pro, time), ent=result[0], renyi=result[1], neg=result[2], mut=result[3], mutr=result[4])
| 37.659389
| 128
| 0.608071
| 1,253
| 8,624
| 4.158819
| 0.155627
| 0.034926
| 0.057571
| 0.081558
| 0.799271
| 0.787949
| 0.787949
| 0.782383
| 0.782383
| 0.782383
| 0
| 0.025426
| 0.26577
| 8,624
| 229
| 128
| 37.659389
| 0.797536
| 0.280496
| 0
| 0.817518
| 0
| 0
| 0.043986
| 0.003952
| 0
| 0
| 0
| 0
| 0
| 1
| 0.036496
| false
| 0
| 0.021898
| 0
| 0.094891
| 0.021898
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
0c9a504465940e2f4f859d53be981646a6dbfcf9
| 267
|
py
|
Python
|
riscv/helpers.py
|
kevinyuan/pydgin
|
9e5dea526a17b23929b2a1d24598154b42323073
|
[
"BSD-3-Clause"
] | 159
|
2015-02-12T03:28:25.000Z
|
2022-02-24T22:40:35.000Z
|
riscv/helpers.py
|
kevinyuan/pydgin
|
9e5dea526a17b23929b2a1d24598154b42323073
|
[
"BSD-3-Clause"
] | 21
|
2015-01-31T23:47:26.000Z
|
2020-12-21T12:41:08.000Z
|
riscv/helpers.py
|
kevinyuan/pydgin
|
9e5dea526a17b23929b2a1d24598154b42323073
|
[
"BSD-3-Clause"
] | 40
|
2015-01-28T21:31:30.000Z
|
2022-01-25T12:50:23.000Z
|
from utils import trim_64
def BRANCH_TARGET( s, inst ):
return trim_64( s.pc + inst.sb_imm )
def JUMP_TARGET( s, inst ):
return trim_64( s.pc + inst.uj_imm )
def SHAMT( s, inst ):
return inst.i_imm & 0x3F
class TRAP_ILLEGAL_INSTRUCTION( Exception ):
pass
| 19.071429
| 44
| 0.70412
| 46
| 267
| 3.869565
| 0.543478
| 0.101124
| 0.185393
| 0.191011
| 0.337079
| 0.337079
| 0.337079
| 0.337079
| 0.337079
| 0
| 0
| 0.037209
| 0.194757
| 267
| 13
| 45
| 20.538462
| 0.790698
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014981
| 0
| 0
| 1
| 0.333333
| false
| 0.111111
| 0.111111
| 0.333333
| 0.888889
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 6
|
0cd57169d4049b03d640aa55a8a78e236004500c
| 7,444
|
py
|
Python
|
custom/icds_reports/tests/agg_tests/test_data_accessor.py
|
rochakchauhan/commcare-hq
|
aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236
|
[
"BSD-3-Clause"
] | 1
|
2020-07-14T13:00:23.000Z
|
2020-07-14T13:00:23.000Z
|
custom/icds_reports/tests/agg_tests/test_data_accessor.py
|
rochakchauhan/commcare-hq
|
aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236
|
[
"BSD-3-Clause"
] | 1
|
2021-06-02T04:45:16.000Z
|
2021-06-02T04:45:16.000Z
|
custom/icds_reports/tests/agg_tests/test_data_accessor.py
|
rochakchauhan/commcare-hq
|
aa7ab3c2d0c51fe10f2b51b08101bb4b5a376236
|
[
"BSD-3-Clause"
] | null | null | null |
from django.test import TestCase
import mock
from custom.icds_reports.utils.data_accessor import get_program_summary_data_with_retrying,\
get_awc_covered_data_with_retrying
class DataAccessorTest(TestCase):
side_effect = [
{
'records': [
[
{'value': 0, 'all': 0},
{'value': 0, 'all': 0},
],
[
{'value': 0, 'all': 0},
{'value': 0, 'all': 0},
],
[
{'value': 0, 'all': 0},
{'value': 0, 'all': 0},
],
[
{'value': 0, 'all': 0},
{'value': 0, 'all': 0},
],
]
},
{
'records': [
[
{'value': 1, 'all': 2},
{'value': 4, 'all': 12},
],
[
{'value': 3, 'all': 4},
{'value': 1, 'all': 2},
],
[
{'value': 6, 'all': 15},
{'value': 5, 'all': 21},
],
[
{'value': 2, 'all': 2},
{'value': 4, 'all': 18},
],
]
},
]
defected_chart_data = {
'all_locations': [
{u'loc_name': u'st2', u'value': 0.0},
{u'loc_name': u'st1', u'value': 0.0},
{u'loc_name': u'st7', u'value': 0.0},
{u'loc_name': u'st3', u'value': 0.0},
{u'loc_name': u'st4', u'value': 0.0},
{u'loc_name': u'st5', u'value': 0.0},
{u'loc_name': u'st6', u'value': 0.0}],
}
valid_chart_data = {
'all_locations': [
{u'loc_name': u'st2', u'value': 0.0},
{u'loc_name': u'st1', u'value': 16.0},
{u'loc_name': u'st7', u'value': 0.0},
{u'loc_name': u'st3', u'value': 21.0},
{u'loc_name': u'st4', u'value': 0.0},
{u'loc_name': u'st5', u'value': 10.0},
{u'loc_name': u'st6', u'value': 0.0}],
}
defected_map_data = {
u'data': {
u'st4': {u'districts': 0, u'blocks': 0, u'awcs': 0, u'original_name': [u'st4'],
u'states': 0, u'supervisors': 0, u'fillKey': u'Not launched'},
u'st5': {u'districts': 0, u'blocks': 0, u'awcs': 0, u'original_name': [u'st5'],
u'states': 0, u'supervisors': 0, u'fillKey': u'Not launched'},
u'st6': {u'districts': 0, u'blocks': 0, u'awcs': 0, u'original_name': [u'st6'],
u'states': 0, u'supervisors': 0, u'fillKey': u'Not launched'},
u'st7': {u'districts': 0, u'blocks': 0, u'awcs': 0, u'original_name': [u'st7'],
u'states': 0, u'supervisors': 0, u'fillKey': u'Launched'},
u'st1': {u'districts': 0, u'blocks': 0, u'awcs': 0, u'original_name': [u'st1'],
u'states': 0, u'supervisors': 0, u'fillKey': u'Launched'},
u'st2': {u'districts': 0, u'blocks': 0, u'awcs': 0, u'original_name': [u'st2'],
u'states': 0, u'supervisors': 0, u'fillKey': u'Launched'},
u'st3': {u'districts': 0, u'blocks': 0, u'awcs': 0, u'original_name': [u'st3'],
u'states': 0, u'supervisors': 0, u'fillKey': u'Not launched'}
},
u'slug': u'awc_covered'}
domain = 'icds-cas'
config = {
'month': (2017, 5, 1),
'prev_month': (2017, 4, 1),
'aggregation_level': 1
}
now = (2017, 6, 1)
def test_retrying_data_for_maternal_child_data(self):
step = 'maternal_child'
with mock.patch(
"custom.icds_reports.utils.data_accessor.get_maternal_child_data",
side_effect=self.side_effect,
autospec=True
) as get_maternal_child_data:
get_program_summary_data_with_retrying(
step, self.domain, self.config, self.now, False, True
)
self.assertEqual(get_maternal_child_data.call_count, 2)
def test_retrying_data_for_cas_reach_data(self):
step = 'icds_cas_reach'
with mock.patch(
"custom.icds_reports.utils.data_accessor.get_cas_reach_data",
side_effect=self.side_effect,
autospec=True
) as get_cas_reach_data:
get_program_summary_data_with_retrying(
step, self.domain, self.config, self.now, False, True
)
self.assertEqual(get_cas_reach_data.call_count, 2)
def test_retrying_data_for_demographics_data(self):
step = 'demographics'
with mock.patch(
"custom.icds_reports.utils.data_accessor.get_demographics_data",
side_effect=self.side_effect,
autospec=True
) as get_demographics_data:
get_program_summary_data_with_retrying(
step, self.domain, self.config, self.now, False, True
)
self.assertEqual(get_demographics_data.call_count, 2)
def test_retrying_data_for_wc_infrastructure_data(self):
step = 'awc_infrastructure'
with mock.patch(
"custom.icds_reports.utils.data_accessor.get_awc_infrastructure_data",
side_effect=self.side_effect,
autospec=True
) as get_awc_infrastructure:
get_program_summary_data_with_retrying(
step, self.domain, self.config, self.now, False, True
)
self.assertEqual(get_awc_infrastructure.call_count, 2)
def test_retrying_data_for_awc_covered_chart(self):
step = 'chart'
get_awc_covered_data_with_retrying.clear(step, self.domain, self.config, 1, 'st1', True)
with mock.patch(
"custom.icds_reports.utils.data_accessor.get_awcs_covered_data_chart",
return_value=self.defected_chart_data,
autospec=True
) as get_awcs_covered_data_chart:
get_awc_covered_data_with_retrying(
step, self.domain, self.config, 1, 'st1', True
)
self.assertEqual(get_awcs_covered_data_chart.call_count, 3)
def test_data_for_awc_covered_chart(self):
step = 'chart'
get_awc_covered_data_with_retrying.clear(step, self.domain, self.config, 1, 'st1', True)
with mock.patch(
"custom.icds_reports.utils.data_accessor.get_awcs_covered_data_chart",
return_value=self.valid_chart_data,
autospec=True
) as get_awcs_covered_data_chart:
get_awc_covered_data_with_retrying(
step, self.domain, self.config, 1, 'st1', True
)
self.assertEqual(get_awcs_covered_data_chart.call_count, 1)
def test_retrying_data_for_awc_covered_map(self):
step = 'map'
get_awc_covered_data_with_retrying.clear(step, self.domain, self.config, 1, 'st1', True)
with mock.patch(
"custom.icds_reports.utils.data_accessor.get_awcs_covered_data_map",
return_value=self.defected_map_data,
autospec=True
) as get_awcs_covered_data_map:
get_awc_covered_data_with_retrying(
step, self.domain, self.config, 1, 'st1', True
)
self.assertEqual(get_awcs_covered_data_map.call_count, 3)
| 39.807487
| 96
| 0.526061
| 921
| 7,444
| 3.986971
| 0.100977
| 0.025599
| 0.030501
| 0.034314
| 0.816449
| 0.802015
| 0.769336
| 0.758987
| 0.741558
| 0.712146
| 0
| 0.034049
| 0.337184
| 7,444
| 186
| 97
| 40.021505
| 0.710174
| 0
| 0
| 0.447674
| 0
| 0
| 0.200699
| 0.060183
| 0
| 0
| 0
| 0
| 0.040698
| 1
| 0.040698
| false
| 0
| 0.017442
| 0
| 0.104651
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
0b3d8fca7f109680f0494f6c7487b172a81fcc7a
| 95
|
py
|
Python
|
chat_utils.py
|
MrUpyachka/bothometh
|
f806a3d711efe03c49833effdb7e152dda0dbeb9
|
[
"Apache-2.0"
] | 1
|
2021-03-06T17:20:12.000Z
|
2021-03-06T17:20:12.000Z
|
chat_utils.py
|
MrUpyachka/bothometh
|
f806a3d711efe03c49833effdb7e152dda0dbeb9
|
[
"Apache-2.0"
] | 2
|
2021-03-06T16:48:00.000Z
|
2021-03-06T16:51:55.000Z
|
chat_utils.py
|
MrUpyachka/bothometh
|
f806a3d711efe03c49833effdb7e152dda0dbeb9
|
[
"Apache-2.0"
] | null | null | null |
from telebot.types import Chat
def is_private(chat: Chat):
return chat.type == 'private'
| 15.833333
| 33
| 0.715789
| 14
| 95
| 4.785714
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.178947
| 95
| 5
| 34
| 19
| 0.858974
| 0
| 0
| 0
| 0
| 0
| 0.073684
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 6
|
0b405c2fc835b3f2f1b570a68b792f9ae9628709
| 14,754
|
py
|
Python
|
tests/test_filled.py
|
contourpy/contourpy
|
3854f86f4ff080a9bf9c4988849b5b9f0a63666e
|
[
"BSD-3-Clause"
] | 14
|
2021-09-17T18:23:07.000Z
|
2022-03-20T14:28:48.000Z
|
tests/test_filled.py
|
ianthomas23/contourpy
|
10df582b7631332467b848981a0255f4739ef901
|
[
"BSD-3-Clause"
] | 9
|
2021-04-22T07:56:38.000Z
|
2022-03-05T14:28:36.000Z
|
tests/test_filled.py
|
ianthomas23/contourpy
|
10df582b7631332467b848981a0255f4739ef901
|
[
"BSD-3-Clause"
] | 1
|
2021-02-19T16:08:56.000Z
|
2021-02-19T16:08:56.000Z
|
from contourpy import contour_generator, FillType
from contourpy.util.data import random, simple
from contourpy.util.mpl_renderer import MplTestRenderer
from image_comparison import compare_images
import numpy as np
from numpy.testing import assert_array_equal
import pytest
import util_test
@pytest.fixture
def two_outers_one_hole():
x, y = np.meshgrid([0., 1., 2., 3.], [0., 1., 2.])
z = np.array([[1.5, 1.5, 0.9, 0.0],
[1.5, 2.8, 0.4, 0.8],
[0.0, 0.0, 0.8, 1.9]])
return x, y, z
@pytest.mark.parametrize("name, fill_type", util_test.all_names_and_fill_types())
def test_filled_simple(name, fill_type):
x, y, z = simple((30, 40))
cont_gen = contour_generator(x, y, z, name=name, fill_type=fill_type)
levels = np.arange(-1.0, 1.01, 0.1)
assert cont_gen.fill_type == fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(image_buffer, "filled_simple.png", f"{name}_{fill_type}")
@pytest.mark.parametrize("name, fill_type", util_test.all_names_and_fill_types())
def test_filled_simple_chunk(name, fill_type):
x, y, z = simple((30, 40))
cont_gen = contour_generator(x, y, z, name=name, fill_type=fill_type, chunk_size=2)
levels = np.arange(-1.0, 1.01, 0.1)
assert cont_gen.fill_type == fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(
image_buffer, "filled_simple_chunk.png", f"{name}_{fill_type}", mean_threshold=0.12)
@pytest.mark.parametrize("name, fill_type", util_test.all_names_and_fill_types())
def test_filled_simple_no_corner_mask(name, fill_type):
x, y, z = simple((30, 40), want_mask=True)
cont_gen = contour_generator(x, y, z, name=name, fill_type=fill_type, corner_mask=False)
levels = np.arange(-1.0, 1.01, 0.1)
assert cont_gen.fill_type == fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(image_buffer, "filled_simple_no_corner_mask.png", f"{name}_{fill_type}")
@pytest.mark.parametrize("name, fill_type", util_test.all_names_and_fill_types())
def test_filled_simple_no_corner_mask_chunk(name, fill_type):
x, y, z = simple((30, 40), want_mask=True)
cont_gen = contour_generator(
x, y, z, name=name, fill_type=fill_type, corner_mask=False, chunk_size=2)
levels = np.arange(-1.0, 1.01, 0.1)
assert cont_gen.fill_type == fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(
image_buffer, "filled_simple_no_corner_mask_chunk.png", f"{name}_{fill_type}",
mean_threshold=0.11,
)
@pytest.mark.parametrize("name", util_test.corner_mask_names())
def test_filled_simple_corner_mask(name):
x, y, z = simple((30, 40), want_mask=True)
fill_type = FillType.OuterCodes
cont_gen = contour_generator(x, y, z, name=name, fill_type=fill_type, corner_mask=True)
levels = np.arange(-1.0, 1.01, 0.1)
assert cont_gen.fill_type == fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(image_buffer, "filled_simple_corner_mask.png", f"{name}_{fill_type}")
@pytest.mark.parametrize("name", util_test.corner_mask_names())
def test_filled_simple_corner_mask_chunk(name):
x, y, z = simple((30, 40), want_mask=True)
fill_type = FillType.OuterCodes
cont_gen = contour_generator(
x, y, z, name=name, fill_type=fill_type, corner_mask=True, chunk_size=2)
levels = np.arange(-1.0, 1.01, 0.1)
assert cont_gen.fill_type == fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(
image_buffer, "filled_simple_corner_mask_chunk.png", f"{name}_{fill_type}",
mean_threshold=0.10,
)
@pytest.mark.parametrize("name", util_test.quad_as_tri_names())
def test_filled_simple_quad_as_tri(name):
x, y, z = simple((30, 40))
cont_gen = contour_generator(x, y, z, name=name, quad_as_tri=True)
levels = np.arange(-1.0, 1.01, 0.1)
fill_type = cont_gen.fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(image_buffer, "filled_simple_quad_as_tri.png", f"{name}")
@pytest.mark.parametrize("name, fill_type", util_test.all_names_and_fill_types())
def test_filled_random(name, fill_type):
x, y, z = random((30, 40), mask_fraction=0.0)
cont_gen = contour_generator(x, y, z, name=name, fill_type=fill_type)
levels = np.arange(0.0, 1.01, 0.2)
assert cont_gen.fill_type == fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(image_buffer, "filled_random.png", f"{name}_{fill_type}")
@pytest.mark.parametrize("name, fill_type", util_test.all_names_and_fill_types())
def test_filled_random_chunk(name, fill_type):
x, y, z = random((30, 40), mask_fraction=0.0)
cont_gen = contour_generator(x, y, z, name=name, fill_type=fill_type, chunk_size=2)
levels = np.arange(0.0, 1.01, 0.2)
assert cont_gen.fill_type == fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
max_threshold = None
mean_threshold = None
if name == "mpl2005":
max_threshold = 128
mean_threshold = 0.16
elif name in ("serial", "threaded"):
if fill_type in (FillType.ChunkCombinedCodes, FillType.ChunkCombinedOffsets):
max_threshold = 99
mean_threshold = 0.142
else:
max_threshold = 135
mean_threshold = 0.19
compare_images(
image_buffer, "filled_random_chunk.png", f"{name}_{fill_type}",
max_threshold=max_threshold, mean_threshold=mean_threshold,
)
@pytest.mark.parametrize("name, fill_type", util_test.all_names_and_fill_types())
def test_filled_random_no_corner_mask(name, fill_type):
x, y, z = random((30, 40), mask_fraction=0.05)
cont_gen = contour_generator(x, y, z, name=name, fill_type=fill_type, corner_mask=False)
levels = np.arange(0.0, 1.01, 0.2)
assert cont_gen.fill_type == fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(image_buffer, "filled_random_no_corner_mask.png", f"{name}_{fill_type}")
@pytest.mark.parametrize("name, fill_type", util_test.all_names_and_fill_types())
def test_filled_random_no_corner_mask_chunk(name, fill_type):
x, y, z = random((30, 40), mask_fraction=0.05)
cont_gen = contour_generator(
x, y, z, name=name, fill_type=fill_type, corner_mask=False, chunk_size=2)
levels = np.arange(0.0, 1.01, 0.2)
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
max_threshold = None
mean_threshold = None
if name == "mpl2005":
max_threshold = 128
mean_threshold = 0.19
elif name in ("serial", "threaded"):
if fill_type in (FillType.ChunkCombinedCodes, FillType.ChunkCombinedOffsets):
max_threshold = 99
mean_threshold = 0.18
else:
max_threshold = 135
mean_threshold = 0.23
compare_images(
image_buffer, "filled_random_no_corner_mask_chunk.png", f"{name}_{fill_type}",
max_threshold=max_threshold, mean_threshold=mean_threshold,
)
@pytest.mark.parametrize("name", util_test.corner_mask_names())
def test_filled_random_corner_mask(name):
x, y, z = random((30, 40), mask_fraction=0.05)
fill_type = FillType.OuterCodes
cont_gen = contour_generator(x, y, z, name=name, corner_mask=True, fill_type=fill_type)
levels = np.arange(0.0, 1.01, 0.2)
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(image_buffer, "filled_random_corner_mask.png", f"{name}_{fill_type}")
@pytest.mark.parametrize("name", util_test.corner_mask_names())
def test_filled_random_corner_mask_chunk(name):
x, y, z = random((30, 40), mask_fraction=0.05)
fill_type = FillType.OuterCodes
cont_gen = contour_generator(
x, y, z, name=name, corner_mask=True, fill_type=fill_type, chunk_size=2)
levels = np.arange(0.0, 1.01, 0.2)
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
max_threshold = None
mean_threshold = None
if name in ("serial", "threaded"):
max_threshold = 135
mean_threshold = 0.17
compare_images(
image_buffer, "filled_random_corner_mask_chunk.png", f"{name}_{fill_type}",
max_threshold=max_threshold, mean_threshold=mean_threshold,
)
@pytest.mark.parametrize("name", util_test.quad_as_tri_names())
def test_filled_random_quad_as_tri(name):
x, y, z = random((30, 40), mask_fraction=0.0)
cont_gen = contour_generator(x, y, z, name=name, quad_as_tri=True)
levels = np.arange(0.0, 1.01, 0.2)
fill_type = cont_gen.fill_type
renderer = MplTestRenderer()
for i in range(len(levels)-1):
renderer.filled(cont_gen.filled(levels[i], levels[i+1]), fill_type, color=f"C{i}")
image_buffer = renderer.save_to_buffer()
compare_images(image_buffer, "filled_random_quad_as_tri.png", f"{name}")
@pytest.mark.parametrize("fill_type", FillType.__members__.values())
@pytest.mark.parametrize("name", ["serial"])
def test_return_by_fill_type(two_outers_one_hole, name, fill_type):
x, y, z = two_outers_one_hole
cont_gen = contour_generator(x, y, z, name, fill_type=fill_type)
assert cont_gen.fill_type == fill_type
filled = cont_gen.filled(1.0, 2.0)
if fill_type in (FillType.OuterCodes, FillType.OuterOffsets):
assert isinstance(filled, tuple) and len(filled) == 2
points = filled[0]
assert isinstance(points, list) and len(points) == 2
for p in points:
assert isinstance(p, np.ndarray)
assert p.dtype == util_test.point_dtype
assert points[0].shape == (13, 2)
assert points[1].shape == (4, 2)
assert_array_equal(points[0][0], points[0][7])
assert_array_equal(points[0][8], points[0][12])
assert_array_equal(points[1][0], points[1][3])
if fill_type == FillType.OuterCodes:
codes = filled[1]
assert isinstance(codes, list) and len(codes) == 2
for c in codes:
assert isinstance(c, np.ndarray)
assert c.dtype == util_test.code_dtype
assert_array_equal(codes[0], [1, 2, 2, 2, 2, 2, 2, 79, 1, 2, 2, 2, 79])
assert_array_equal(codes[1], [1, 2, 2, 79])
else: # FillType.OuterOffsets.
offsets = filled[1]
assert isinstance(offsets, list) and len(offsets) == 2
for o in offsets:
assert isinstance(o, np.ndarray)
assert o.dtype == util_test.offset_dtype
assert_array_equal(offsets[0], [0, 8, 13])
assert_array_equal(offsets[1], [0, 4])
elif fill_type in (FillType.ChunkCombinedCodes, FillType.ChunkCombinedOffsets,
FillType.ChunkCombinedCodesOffsets, FillType.ChunkCombinedOffsets2):
if fill_type in (FillType.ChunkCombinedCodes, FillType.ChunkCombinedOffsets):
assert isinstance(filled, tuple) and len(filled) == 2
else:
assert isinstance(filled, tuple) and len(filled) == 3
points = filled[0]
assert isinstance(points, list) and len(points) == 1
points = points[0]
assert isinstance(points, np.ndarray)
assert points.dtype == util_test.point_dtype
assert points.shape == (17, 2)
assert_array_equal(points[0], points[7])
assert_array_equal(points[8], points[12])
assert_array_equal(points[13], points[16])
if fill_type in (FillType.ChunkCombinedCodes, FillType.ChunkCombinedCodesOffsets):
codes = filled[1]
assert isinstance(codes, list) and len(codes) == 1
codes = codes[0]
assert isinstance(codes, np.ndarray)
assert codes.dtype == util_test.code_dtype
assert_array_equal(codes, [1, 2, 2, 2, 2, 2, 2, 79, 1, 2, 2, 2, 79, 1, 2, 2, 79])
else:
offsets = filled[1]
assert isinstance(offsets, list) and len(offsets) == 1
offsets = offsets[0]
assert isinstance(offsets, np.ndarray)
assert offsets.dtype == util_test.offset_dtype
assert_array_equal(offsets, [0, 8, 13, 17])
if fill_type in (FillType.ChunkCombinedCodesOffsets, FillType.ChunkCombinedOffsets2):
outer_offsets = filled[2]
assert isinstance(outer_offsets, list) and len(outer_offsets) == 1
outer_offsets = outer_offsets[0]
assert isinstance(outer_offsets, np.ndarray)
assert outer_offsets.dtype == util_test.offset_dtype
if fill_type == FillType.ChunkCombinedCodesOffsets:
assert_array_equal(outer_offsets, [0, 13, 17])
else:
assert_array_equal(outer_offsets, [0, 2, 3])
else:
raise RuntimeError(f"Unexpected fill_type {fill_type}")
| 39.98374
| 93
| 0.671004
| 2,189
| 14,754
| 4.269986
| 0.063042
| 0.094148
| 0.051353
| 0.041083
| 0.849256
| 0.827859
| 0.803894
| 0.766556
| 0.743875
| 0.720231
| 0
| 0.035394
| 0.199539
| 14,754
| 368
| 94
| 40.092391
| 0.756054
| 0.001491
| 0
| 0.589831
| 0
| 0
| 0.063883
| 0.025255
| 0
| 0
| 0
| 0
| 0.176271
| 1
| 0.054237
| false
| 0
| 0.027119
| 0
| 0.084746
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
0bb633ad9cde42afd37ce845581f45a86ebc8971
| 84
|
py
|
Python
|
micatutorial3/plotting/__init__.py
|
OualidBenkarim/micatutorial3
|
412fc148aaff62ab2b18aa68ee289efaac2d0946
|
[
"BSD-3-Clause"
] | 1
|
2022-03-17T19:45:27.000Z
|
2022-03-17T19:45:27.000Z
|
micatutorial3/plotting/__init__.py
|
OualidBenkarim/micatutorial3
|
412fc148aaff62ab2b18aa68ee289efaac2d0946
|
[
"BSD-3-Clause"
] | null | null | null |
micatutorial3/plotting/__init__.py
|
OualidBenkarim/micatutorial3
|
412fc148aaff62ab2b18aa68ee289efaac2d0946
|
[
"BSD-3-Clause"
] | null | null | null |
from .utils import plot_primes, plot_fibo
__all__ = ['plot_primes', 'plot_fibo']
| 14
| 41
| 0.738095
| 12
| 84
| 4.5
| 0.583333
| 0.37037
| 0.518519
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 84
| 5
| 42
| 16.8
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0.243902
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 6
|
e7f255d72d8ba6a46e1a7309af08762973dfa053
| 6,557
|
py
|
Python
|
tests/PPO/test_model.py
|
CVxTz/RL
|
59437bb4aee4052852dfde74d95e85a0d024819c
|
[
"MIT"
] | 9
|
2020-11-22T04:44:39.000Z
|
2022-02-18T16:16:46.000Z
|
tests/PPO/test_model.py
|
CVxTz/RL
|
59437bb4aee4052852dfde74d95e85a0d024819c
|
[
"MIT"
] | null | null | null |
tests/PPO/test_model.py
|
CVxTz/RL
|
59437bb4aee4052852dfde74d95e85a0d024819c
|
[
"MIT"
] | 3
|
2021-01-23T02:53:46.000Z
|
2021-09-15T01:54:45.000Z
|
import gym
import numpy as np
import torch
import torch.optim as optim
from torch.utils.data import DataLoader
from PPO.model import (
PolicyNetwork,
ValueNetwork,
device,
train_value_network,
train_policy_network,
)
from PPO.replay import Episode, History
def test_model_1():
env = gym.make("LunarLander-v2")
observation = env.reset()
n_actions = env.action_space.n
feature_dim = observation.size
policy_model = PolicyNetwork(n=n_actions, in_dim=feature_dim)
policy_model.to(device)
action, log_probability = policy_model.sample_action(observation)
assert action in list(range(n_actions))
def test_model_2():
env = gym.make("LunarLander-v2")
observation = env.reset()
n_actions = env.action_space.n
feature_dim = observation.size
policy_model = PolicyNetwork(n=n_actions, in_dim=feature_dim)
policy_model.to(device)
observations = [observation / i for i in range(1, 11)]
observations = torch.from_numpy(np.array(observations)).to(device)
probs = policy_model(observations)
assert list(probs.size()) == [10, n_actions]
assert abs(probs[0, :].sum().item() - 1) < 1e-3
def test_model_3():
env = gym.make("LunarLander-v2")
observation = env.reset()
n_actions = env.action_space.n
feature_dim = observation.size
policy_model = PolicyNetwork(n=n_actions, in_dim=feature_dim)
policy_model.to(device)
observations = [observation / i for i in range(1, 11)]
actions = [i % 4 for i in range(1, 11)]
observations = torch.from_numpy(np.array(observations)).to(device)
actions = torch.IntTensor(actions).to(device)
log_probabilities, entropy = policy_model.evaluate_actions(observations, actions)
assert list(log_probabilities.size()) == [10]
assert list(entropy.size()) == [10]
def test_history_episode_model():
reward_scale = 20
env = gym.make("LunarLander-v2")
observation = env.reset()
n_actions = env.action_space.n
feature_dim = observation.size
policy_model = PolicyNetwork(n=n_actions, in_dim=feature_dim).to(device)
value_model = ValueNetwork(in_dim=feature_dim).to(device)
max_episodes = 10
max_timesteps = 100
reward_sum = 0
ite = 0
history = History()
for episode_i in range(max_episodes):
observation = env.reset()
episode = Episode()
for timestep in range(max_timesteps):
action, log_probability = policy_model.sample_action(observation)
value = value_model.state_value(observation)
new_observation, reward, done, info = env.step(action)
episode.append(
observation=observation,
action=action,
reward=reward,
value=value,
log_probability=log_probability,
reward_scale=reward_scale,
)
observation = new_observation
reward_sum += reward
ite += 1
if done:
episode.end_episode(last_value=np.random.uniform())
break
if timestep == max_timesteps - 1:
episode.end_episode(last_value=0)
history.add_episode(episode)
history.build_dataset()
assert abs(np.sum(history.rewards) - reward_sum / reward_scale) < 1e-5
assert len(history.rewards) == ite
assert abs(np.mean(history.advantages)) <= 1e-10
assert abs(np.std(history.advantages) - 1) <= 1e-3
def test_value_network():
env = gym.make("LunarLander-v2")
observation = env.reset()
n_actions = env.action_space.n
feature_dim = observation.size
n_epoch = 4
max_episodes = 10
max_timesteps = 100
reward_sum = 0
ite = 0
history = History()
for episode_i in range(max_episodes):
observation = env.reset()
episode = Episode()
for timestep in range(max_timesteps):
action = env.action_space.sample()
new_observation, reward, done, info = env.step(action)
episode.append(
observation=observation,
action=action,
reward=reward,
value=ite,
log_probability=np.log(1 / n_actions),
)
observation = new_observation
reward_sum += reward
ite += 1
if done:
episode.end_episode(last_value=np.random.uniform())
break
if timestep == max_timesteps - 1:
episode.end_episode(last_value=0)
history.add_episode(episode)
history.build_dataset()
value_model = ValueNetwork(in_dim=feature_dim).to(device)
value_optimizer = optim.Adam(value_model.parameters(), lr=0.001)
data_loader = DataLoader(history, batch_size=64, shuffle=True)
epochs_losses = train_value_network(
value_model, value_optimizer, data_loader, epochs=n_epoch
)
assert epochs_losses[0] > epochs_losses[-1]
def test_policy_network():
env = gym.make("LunarLander-v2")
observation = env.reset()
n_actions = env.action_space.n
feature_dim = observation.size
n_epoch = 4
max_episodes = 10
max_timesteps = 100
reward_sum = 0
ite = 0
history = History()
for episode_i in range(max_episodes):
observation = env.reset()
episode = Episode()
for timestep in range(max_timesteps):
action = env.action_space.sample()
new_observation, reward, done, info = env.step(action)
episode.append(
observation=observation,
action=action,
reward=reward,
value=ite,
log_probability=np.log(1 / n_actions),
)
observation = new_observation
reward_sum += reward
ite += 1
if done:
episode.end_episode(last_value=np.random.uniform())
break
if timestep == max_timesteps - 1:
episode.end_episode(last_value=0)
history.add_episode(episode)
history.build_dataset()
policy_model = PolicyNetwork(in_dim=feature_dim).to(device)
policy_optimizer = optim.Adam(policy_model.parameters(), lr=0.01)
data_loader = DataLoader(history, batch_size=64, shuffle=True)
epochs_losses = train_policy_network(
policy_model, policy_optimizer, data_loader, epochs=n_epoch
)
assert epochs_losses[0] > epochs_losses[-1]
| 24.106618
| 85
| 0.628641
| 785
| 6,557
| 5.035669
| 0.140127
| 0.028333
| 0.043258
| 0.026562
| 0.750569
| 0.745004
| 0.739185
| 0.735897
| 0.710094
| 0.687326
| 0
| 0.018546
| 0.276346
| 6,557
| 271
| 86
| 24.195572
| 0.814542
| 0
| 0
| 0.709302
| 0
| 0
| 0.012811
| 0
| 0
| 0
| 0
| 0
| 0.063953
| 1
| 0.034884
| false
| 0
| 0.040698
| 0
| 0.075581
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
f0167f7cb56947745fd63d5fbf5ecba1bf79926f
| 6,944
|
py
|
Python
|
openstackinabox/tests/services/keystone/v2/user/test_listing.py
|
BenjamenMeyer/openstackinabox
|
b5097695719b818dd06e3773899f80a15e7e71c1
|
[
"Apache-2.0"
] | 1
|
2017-11-19T20:31:48.000Z
|
2017-11-19T20:31:48.000Z
|
openstackinabox/tests/services/keystone/v2/user/test_listing.py
|
TestInABox/openstackinabox
|
00dcac601d14e1cfc240840dd92895ee322caf96
|
[
"Apache-2.0"
] | 38
|
2016-05-05T18:03:21.000Z
|
2020-04-11T03:33:01.000Z
|
openstackinabox/tests/services/keystone/v2/user/test_listing.py
|
BenjamenMeyer/openstackinabox
|
b5097695719b818dd06e3773899f80a15e7e71c1
|
[
"Apache-2.0"
] | 1
|
2015-05-28T14:53:46.000Z
|
2015-05-28T14:53:46.000Z
|
"""
Stack-In-A-Box: Basic Test
"""
import unittest
import requests
import stackinabox.util.requests_mock.core
from stackinabox.stack import StackInABox
from openstackinabox.services.keystone import KeystoneV2Service
class TestKeystoneV2UserListing(unittest.TestCase):
def setUp(self):
super(TestKeystoneV2UserListing, self).setUp()
self.keystone = KeystoneV2Service()
self.headers = {
'x-auth-token': self.keystone.model.tokens.admin_token
}
StackInABox.register_service(self.keystone)
def tearDown(self):
super(TestKeystoneV2UserListing, self).tearDown()
StackInABox.reset_services()
def test_user_listing_no_token(self):
with stackinabox.util.requests_mock.core.activate():
stackinabox.util.requests_mock.core.requests_mock_registration(
'localhost')
res = requests.get('http://localhost/keystone/v2.0/users')
self.assertEqual(res.status_code, 403)
def test_user_listing_bad_token(self):
with stackinabox.util.requests_mock.core.activate():
stackinabox.util.requests_mock.core.requests_mock_registration(
'localhost')
self.headers['x-auth-token'] = 'new_token'
res = requests.get('http://localhost/keystone/v2.0/users',
headers=self.headers)
self.assertEqual(res.status_code, 401)
def test_user_listing(self):
with stackinabox.util.requests_mock.core.activate():
stackinabox.util.requests_mock.core.requests_mock_registration(
'localhost')
neo_tenant_id = self.keystone.model.tenants.add(
tenant_name='neo',
description='The One')
tom = self.keystone.model.users.add(
neo_tenant_id,
'tom',
'[email protected]',
'bluepill',
'iamnottheone',
enabled=True
)
self.keystone.model.roles.add_user_role_by_role_name(
neo_tenant_id,
tom,
'identity:user-admin')
self.keystone.model.tokens.add(neo_tenant_id, tom)
user_data = self.keystone.model.tokens.get_by_user_id(tom)
self.headers['x-auth-token'] = user_data['token']
res = requests.get('http://localhost/keystone/v2.0/users',
headers=self.headers)
self.assertEqual(res.status_code, 200)
user_data = res.json()
self.assertEqual(len(user_data['users']), 1)
self.keystone.model.users.add(
neo_tenant_id,
'neo',
'[email protected]',
'redpill',
'iamtheone',
enabled=True
)
res = requests.get('http://localhost/keystone/v2.0/users',
headers=self.headers)
self.assertEqual(res.status_code, 200)
user_data = res.json()
self.assertEqual(len(user_data['users']), 2)
def test_user_listing_by_name(self):
with stackinabox.util.requests_mock.core.activate():
stackinabox.util.requests_mock.core.requests_mock_registration(
'localhost')
neo_tenant_id = self.keystone.model.tenants.add(
tenant_name='neo',
description='The One')
tom = self.keystone.model.users.add(
neo_tenant_id,
'tom',
'[email protected]',
'bluepill',
'iamnottheone',
enabled=True
)
self.keystone.model.roles.add_user_role_by_role_name(
neo_tenant_id,
tom,
'identity:user-admin')
self.keystone.model.tokens.add(neo_tenant_id, tom)
user_data = self.keystone.model.tokens.get_by_user_id(tom)
self.headers['x-auth-token'] = user_data['token']
res = requests.get('http://localhost/keystone/v2.0/users',
headers=self.headers)
self.assertEqual(res.status_code, 200)
user_data = res.json()
self.assertEqual(len(user_data['users']), 1)
self.keystone.model.users.add(
neo_tenant_id,
'neo',
'[email protected]',
'redpill',
'iamtheone',
enabled=True
)
res = requests.get('http://localhost/keystone/v2.0/users?name=tom',
headers=self.headers)
self.assertEqual(res.status_code, 200)
user_data = res.json()
self.assertIn('user', user_data)
self.assertEqual(len(user_data), 1)
self.assertEqual(user_data['user']['username'], 'tom')
def test_user_listing_with_invalid_query_param(self):
with stackinabox.util.requests_mock.core.activate():
stackinabox.util.requests_mock.core.requests_mock_registration(
'localhost')
neo_tenant_id = self.keystone.model.tenants.add(
tenant_name='neo',
description='The One'
)
tom = self.keystone.model.users.add(
tenant_id=neo_tenant_id,
username='tom',
email='[email protected]',
password='bluepill',
apikey='iamnottheone',
enabled=True
)
self.keystone.model.roles.add_user_role_by_role_name(
tenant_id=neo_tenant_id,
user_id=tom,
role_name='identity:user-admin'
)
self.keystone.model.tokens.add(
tenant_id=neo_tenant_id,
user_id=tom
)
user_data = self.keystone.model.tokens.get_by_user_id(tom)
self.headers['x-auth-token'] = user_data['token']
res = requests.get(
'http://localhost/keystone/v2.0/users?honesty=False',
headers=self.headers
)
self.assertEqual(res.status_code, 200)
user_data = res.json()
self.assertEqual(len(user_data['users']), 1)
self.keystone.model.users.add(
tenant_id=neo_tenant_id,
username='neo',
email='[email protected]',
password='redpill',
apikey='iamtheone',
enabled=True
)
res = requests.get(
'http://localhost/keystone/v2.0/users',
headers=self.headers
)
self.assertEqual(res.status_code, 200)
user_data = res.json()
self.assertEqual(len(user_data['users']), 2)
| 34.894472
| 79
| 0.547811
| 709
| 6,944
| 5.172073
| 0.132581
| 0.068721
| 0.088083
| 0.080993
| 0.800109
| 0.765476
| 0.765476
| 0.765476
| 0.739842
| 0.728116
| 0
| 0.011231
| 0.346054
| 6,944
| 198
| 80
| 35.070707
| 0.7963
| 0.003744
| 0
| 0.658385
| 0
| 0
| 0.11563
| 0
| 0
| 0
| 0
| 0
| 0.099379
| 1
| 0.043478
| false
| 0.012422
| 0.031056
| 0
| 0.080745
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
f02a4b229a536558e7ff0751f50d32c6fc2560c2
| 8,956
|
py
|
Python
|
test/brahe/test_epoch.py
|
duncaneddy/brahe
|
4a1746ef3c14211b0709de6e7e34b6f52fc0e686
|
[
"MIT"
] | 14
|
2019-05-29T13:36:55.000Z
|
2022-02-11T15:26:13.000Z
|
test/brahe/test_epoch.py
|
duncaneddy/brahe
|
4a1746ef3c14211b0709de6e7e34b6f52fc0e686
|
[
"MIT"
] | 1
|
2020-05-27T12:14:39.000Z
|
2020-05-27T15:51:21.000Z
|
test/brahe/test_epoch.py
|
duncaneddy/brahe
|
4a1746ef3c14211b0709de6e7e34b6f52fc0e686
|
[
"MIT"
] | 2
|
2019-10-24T05:20:54.000Z
|
2019-12-08T03:59:10.000Z
|
# Test Imports
from pytest import approx
# Modules Under Test
import brahe.constants as _constants
from brahe.epoch import *
# Set Log level
LOG_FORMAT = '%(levelname)s [%(filename)s:%(funcName)s:%(lineno)d] %(message)s'
logging.basicConfig(format=LOG_FORMAT, level=logging.DEBUG)
# Other imports
import math
def test_constructor_date():
epc = Epoch(2018, 12, 20, 0, 0, 0, 0.0, tsys="TAI")
assert epc.days == 2458472
assert epc.seconds == 43200
assert epc.nanoseconds == 0.0
assert epc.tsys == "TAI"
epc = Epoch(2018, 12, 20, 0, 0, .5, 1.0001, tsys="TAI")
assert epc.days == 2458472
assert epc.seconds == 43200
assert epc.nanoseconds == 500000001.0001
assert epc.tsys == "TAI"
# String constructor
def test_constructor_string():
epc = Epoch("2018-12-20")
year, month, day, hour, minute, seconds, nanoseconds = epc.caldate()
assert year == 2018
assert month == 12
assert day == 20
assert hour == 0
assert minute == 0
assert seconds == 0
assert nanoseconds == 0.0
assert epc.tsys == "UTC"
epc = Epoch("2018-12-20T16:22:19.0Z")
year, month, day, hour, minute, seconds, nanoseconds = epc.caldate()
assert year == 2018
assert month == 12
assert day == 20
assert hour == 16
assert minute == 22
assert seconds == 19
assert nanoseconds == 0.0
assert epc.tsys == "UTC"
epc = Epoch("2018-12-20T16:22:19.123Z")
year, month, day, hour, minute, seconds, nanoseconds = epc.caldate()
assert year == 2018
assert month == 12
assert day == 20
assert hour == 16
assert minute == 22
assert seconds == 19
assert nanoseconds == 123000000
assert epc.tsys == "UTC"
epc = Epoch("2018-12-20T16:22:19.123456789Z")
year, month, day, hour, minute, seconds, nanoseconds = epc.caldate()
assert year == 2018
assert month == 12
assert day == 20
assert hour == 16
assert minute == 22
assert seconds == 19
assert nanoseconds == 123456789
assert epc.tsys == "UTC"
epc = Epoch("2018-12-20T16:22:19Z")
year, month, day, hour, minute, seconds, nanoseconds = epc.caldate()
assert year == 2018
assert month == 12
assert day == 20
assert hour == 16
assert minute == 22
assert seconds == 19
assert nanoseconds == 0.0
assert epc.tsys == "UTC"
epc = Epoch("20181220T162219Z")
year, month, day, hour, minute, seconds, nanoseconds = epc.caldate()
assert year == 2018
assert month == 12
assert day == 20
assert hour == 16
assert minute == 22
assert seconds == 19
assert nanoseconds == 0.0
assert epc.tsys == "UTC"
epc = Epoch("2018-12-01 16:22:19 GPS")
year, month, day, hour, minute, seconds, nanoseconds = epc.caldate(tsys="GPS")
assert year == 2018
assert month == 12
assert day == 1
assert hour == 16
assert minute == 22
assert seconds == 19
assert nanoseconds == 0.0
assert epc.tsys == "GPS"
epc = Epoch("2018-12-01 16:22:19.0 GPS")
year, month, day, hour, minute, seconds, nanoseconds = epc.caldate(tsys="GPS")
assert year == 2018
assert month == 12
assert day == 1
assert hour == 16
assert minute == 22
assert seconds == 19
assert nanoseconds == 0.0
assert epc.tsys == "GPS"
epc = Epoch("2018-12-01 16:22:19.123 GPS")
year, month, day, hour, minute, seconds, nanoseconds = epc.caldate(tsys="GPS")
assert year == 2018
assert month == 12
assert day == 1
assert hour == 16
assert minute == 22
assert seconds == 19
assert nanoseconds == 123000000
assert epc.tsys == "GPS"
epc = Epoch("2018-12-01 16:22:19.123456789 GPS")
year, month, day, hour, minute, seconds, nanoseconds = epc.caldate(tsys="GPS")
assert year == 2018
assert month == 12
assert day == 1
assert hour == 16
assert minute == 22
assert seconds == 19
assert nanoseconds == 123456789
assert epc.tsys == "GPS"
def test_operators():
epc = Epoch("2019-01-01 12:00:00 TAI")
assert epc.days == 2458485
assert epc.seconds == 0
assert epc.nanoseconds == 0
epc += 1.0e-9
assert epc.days == 2458485
assert epc.seconds == 0
assert epc.nanoseconds == 1
epc -= 2.0e-9
assert epc.days == 2458484
assert epc.seconds == 86399
assert epc.nanoseconds == 999999999
for _ in range(0, 86400):
epc += 1
assert epc.days == 2458485
assert epc.seconds == 86399
assert epc.nanoseconds == 999999999
year, month, day, hour, minute, second, nanoseconds = epc.caldate("TAI")
assert year == 2019
assert month == 1
assert day == 2
assert hour == 11
assert minute == 59
assert second == 59
assert nanoseconds == 999999999
# This test takes longer to run
# for _ in range(0, 365*86400):
# epc += 1
# assert epc.days == 2458849
# assert epc.seconds == 86399
# assert epc.nanoseconds == 999999999
# year, month, day, hour, minute, second, nanoseconds = epc.caldate("TAI")
# assert year == 2020
# assert month == 1
# assert day == 1
# assert hour == 11
# assert minute == 59
# assert second == 59
# assert nanoseconds == 999999999
def test_conversion():
epc = Epoch("2018-12-20T16:22:19.123456789Z", tsys="TAI")
year, month, day, hour, minute, second, nanoseconds = epc.caldate(tsys="TAI")
assert year == 2018
assert month == 12
assert day == 20
assert hour == 16
assert minute == 22
assert second == 19 + 37
assert nanoseconds == 123456789.0
epc = Epoch("2018-12-20T16:22:19.123456789Z")
year, month, day, hour, minute, second, nanoseconds = epc.caldate(tsys="GPS")
assert year == 2018
assert month == 12
assert day == 20
assert hour == 16
assert minute == 22
assert second == 19 + 37 - 19
assert nanoseconds == 123456789.0
def test_jd():
epc = Epoch(2000, 1, 1, tsys="GPS")
assert epc.jd() == 2451544.5
assert epc.jd(tsys="UTC") < 2451544.5
def test_mjd():
epc = Epoch(2000, 1, 1, 0, tsys="GPS")
assert epc.mjd() == 51544
assert epc.mjd(tsys="UTC") < 51544
def test_day_of_year():
epc = Epoch(2000, 1, 1)
assert epc.day_of_year() == 1
epc = Epoch(2000, 1, 1, 12)
assert epc.day_of_year() == 1.5
epc = Epoch(2000, 12, 31)
assert epc.day_of_year() == 366
epc = Epoch(2001, 1, 1)
assert epc.day_of_year() == 1
epc = Epoch(2001, 12, 31)
assert epc.day_of_year() == 365
def test_gmst():
epc = Epoch(2000, 1, 1)
assert approx(epc.gmst(use_degrees=True), 99.835, abs=1e-3)
epc = Epoch(2000, 1, 1)
assert approx(epc.gmst(use_degrees=False), 1.742, abs=1e-3)
def test_gast():
epc = Epoch(2000, 1, 1)
assert approx(epc.gast(use_degrees=True), 99.832, abs=1e-3)
epc = Epoch(2000, 1, 1)
assert approx(epc.gast(use_degrees=False), 1.742, abs=1e-3)
# Arithmetic Comparisons
def test_logic():
# Equal, Not Equal
assert Epoch(2000, 1, 1, 12, 23, 59, 123456789) == Epoch(2000, 1, 1, 12, 23, 59, 123456789)
assert Epoch(2000, 1, 1, 12, 23, 59, 123456789) != Epoch(2000, 1, 1, 12, 23, 59, 123456788)
# Less-than, Less-than-equal
assert not (Epoch(2000, 1, 1, 12, 23, 59, 123456789) < Epoch(2000, 1, 1, 12, 23, 59, 123456789))
assert not (Epoch(2000, 1, 1, 12, 23, 59, 123456789) <= Epoch(2000, 1, 1, 12, 23, 59, 123456788))
assert Epoch(2000, 1, 1, 12, 23, 59, 123456788) < Epoch(2000, 1, 1, 12, 23, 59, 123456789)
assert Epoch(2000, 1, 1, 12, 23, 59, 123456788) <= Epoch(2000, 1, 1, 12, 23, 59, 123456789)
# Greater-than, Greater-than-equal
assert not (Epoch(2000, 1, 1, 12, 23, 59, 123456789) > Epoch(2000, 1, 1, 12, 23, 59, 123456789))
assert not (Epoch(2000, 1, 1, 12, 23, 59, 123456788) >= Epoch(2000, 1, 1, 12, 23, 59, 123456789))
assert Epoch(2000, 1, 1, 12, 23, 59, 123456789) > Epoch(2000, 1, 1, 12, 23, 59, 123456788)
assert Epoch(2000, 1, 1, 12, 23, 59, 123456789) >= Epoch(2000, 1, 1, 12, 23, 59, 123456788)
def test_epoch_rage():
epc_start = Epoch(2020, 1, 1)
epc_end = Epoch(2020, 1, 2)
step = 1
epcs = [epc for epc in epoch_range(epc_start, epc_end, step)]
assert len(epcs) == 86401
assert epcs[0] == epc_start
assert epcs[-1] == epc_end
| 32.33213
| 101
| 0.572465
| 1,213
| 8,956
| 4.192086
| 0.112119
| 0.074336
| 0.055064
| 0.06057
| 0.792527
| 0.770108
| 0.754966
| 0.7353
| 0.711504
| 0.711504
| 0
| 0.1985
| 0.300246
| 8,956
| 277
| 102
| 32.33213
| 0.612893
| 0.067887
| 0
| 0.582938
| 0
| 0.004739
| 0.054655
| 0.020901
| 0
| 0
| 0
| 0
| 0.696682
| 1
| 0.052133
| false
| 0
| 0.018957
| 0
| 0.07109
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
b2d55d4cfd831d0168dbbdf51e39c3374689aba2
| 60
|
py
|
Python
|
python/comp_200/importing.py
|
sethmccauley/cohort4
|
9f862e3e1f13d2c0f81430d16d67564c7c19f8a1
|
[
"MIT"
] | null | null | null |
python/comp_200/importing.py
|
sethmccauley/cohort4
|
9f862e3e1f13d2c0f81430d16d67564c7c19f8a1
|
[
"MIT"
] | 11
|
2020-11-16T22:45:04.000Z
|
2022-02-27T00:13:50.000Z
|
python/comp_200/importing.py
|
sethmccauley/cohort4
|
9f862e3e1f13d2c0f81430d16d67564c7c19f8a1
|
[
"MIT"
] | null | null | null |
def divide(divident, divisor):
return divident / divisor
| 30
| 30
| 0.75
| 7
| 60
| 6.428571
| 0.714286
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 60
| 2
| 31
| 30
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 6
|
b2e1f9b1af4cacbbe03cca21c889e5277d803452
| 60
|
py
|
Python
|
sparkserve/datamanagement/JSONOutputConverter.py
|
ruturajpatel/SparkServe
|
3fcbb87b8c7ba5662a375ad48f8d05be3c0bac76
|
[
"MIT"
] | null | null | null |
sparkserve/datamanagement/JSONOutputConverter.py
|
ruturajpatel/SparkServe
|
3fcbb87b8c7ba5662a375ad48f8d05be3c0bac76
|
[
"MIT"
] | null | null | null |
sparkserve/datamanagement/JSONOutputConverter.py
|
ruturajpatel/SparkServe
|
3fcbb87b8c7ba5662a375ad48f8d05be3c0bac76
|
[
"MIT"
] | null | null | null |
import json
def getString(obj):
return json.dumps(obj)
| 12
| 26
| 0.716667
| 9
| 60
| 4.777778
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.183333
| 60
| 5
| 26
| 12
| 0.877551
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 6
|
65216fb892ba91ea0be0989b69de7a50b6708d24
| 34
|
py
|
Python
|
mine_torch/model_zoo.py
|
buoyancy99/MineTorch
|
d1b0a3a19c09f477f13e03d736f7d7a522c05916
|
[
"MIT"
] | 16
|
2019-08-09T21:54:25.000Z
|
2022-03-05T14:56:22.000Z
|
mine_torch/model_zoo.py
|
buoyancy99/MineTorch
|
d1b0a3a19c09f477f13e03d736f7d7a522c05916
|
[
"MIT"
] | null | null | null |
mine_torch/model_zoo.py
|
buoyancy99/MineTorch
|
d1b0a3a19c09f477f13e03d736f7d7a522c05916
|
[
"MIT"
] | 3
|
2019-08-10T20:43:22.000Z
|
2020-10-25T07:25:34.000Z
|
import torch
import torchvision
| 6.8
| 18
| 0.823529
| 4
| 34
| 7
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.176471
| 34
| 4
| 19
| 8.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
e8e52a5f167f17da87cca87a8bbef6164d35f191
| 164
|
py
|
Python
|
photos/admin.py
|
maurinesinami/gallery
|
63230d18a268a8ebf264e13128c74439dedc5977
|
[
"MIT"
] | null | null | null |
photos/admin.py
|
maurinesinami/gallery
|
63230d18a268a8ebf264e13128c74439dedc5977
|
[
"MIT"
] | 3
|
2020-06-05T21:21:20.000Z
|
2021-09-08T01:03:44.000Z
|
photos/admin.py
|
maurinesinami/gallery
|
63230d18a268a8ebf264e13128c74439dedc5977
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Image,Location,Category
admin.site.register(Image)
admin.site.register(Category)
admin.site.register(Location)
| 27.333333
| 43
| 0.835366
| 23
| 164
| 5.956522
| 0.478261
| 0.19708
| 0.372263
| 0.364964
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.067073
| 164
| 5
| 44
| 32.8
| 0.895425
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 6
|
335ac61f9eb54dcc4a15e092d0dc5b0c816f99a6
| 203
|
py
|
Python
|
src/test_hash.py
|
skandabhairava/Scripting_tools
|
cb36358412732bbd36ecdad079c719518689105e
|
[
"MIT"
] | 1
|
2021-10-11T13:49:57.000Z
|
2021-10-11T13:49:57.000Z
|
src/test_hash.py
|
skandabhairava/Scripting_tools
|
cb36358412732bbd36ecdad079c719518689105e
|
[
"MIT"
] | 1
|
2022-02-16T18:57:36.000Z
|
2022-02-16T18:57:36.000Z
|
src/test_hash.py
|
skandabhairava/Scripting_tools
|
cb36358412732bbd36ecdad079c719518689105e
|
[
"MIT"
] | null | null | null |
from scripting_tools.hash import hash, validate_hash
hashed_code = hash("Hello!")
print(hashed_code)
print(validate_hash(hashed_code, "Hello")) #False
print(validate_hash(hashed_code, "Hello!")) #True
| 25.375
| 52
| 0.783251
| 29
| 203
| 5.206897
| 0.413793
| 0.264901
| 0.357616
| 0.437086
| 0.423841
| 0.423841
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083744
| 203
| 8
| 53
| 25.375
| 0.811828
| 0.044335
| 0
| 0
| 0
| 0
| 0.088083
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 0.2
| 0.6
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 6
|
335cd20e7c97c030d6c96b03ca45ac4baa190102
| 445
|
py
|
Python
|
odoo-13.0/addons/sale/tests/__init__.py
|
VaibhavBhujade/Blockchain-ERP-interoperability
|
b5190a037fb6615386f7cbad024d51b0abd4ba03
|
[
"MIT"
] | 12
|
2021-03-26T08:39:40.000Z
|
2022-03-16T02:20:10.000Z
|
odoo-13.0/addons/sale/tests/__init__.py
|
VaibhavBhujade/Blockchain-ERP-interoperability
|
b5190a037fb6615386f7cbad024d51b0abd4ba03
|
[
"MIT"
] | 13
|
2020-12-20T16:00:21.000Z
|
2022-03-14T14:55:30.000Z
|
odoo-13.0/addons/sale/tests/__init__.py
|
VaibhavBhujade/Blockchain-ERP-interoperability
|
b5190a037fb6615386f7cbad024d51b0abd4ba03
|
[
"MIT"
] | 17
|
2020-08-31T11:18:49.000Z
|
2022-02-09T05:57:31.000Z
|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_sale_product_attribute_value_config
from . import test_sale_to_invoice
from . import test_sale_order
from . import test_sale_pricelist
from . import test_onchange
from . import test_reinvoice
from . import test_access_rights
from . import test_sale_refund
from . import test_sale_signature
from . import test_sale_transaction
| 31.785714
| 74
| 0.817978
| 67
| 445
| 5.104478
| 0.507463
| 0.292398
| 0.409357
| 0.368421
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002591
| 0.132584
| 445
| 13
| 75
| 34.230769
| 0.88342
| 0.211236
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
33607d568a073e7d4e7bf82646ad1f457cb1ae1e
| 131
|
py
|
Python
|
Assignments/Assignment_03/ekf/utils/check_array.py
|
chrstrom/TTK4250
|
f453c3a59597d3fe6cff7d35b790689919798b94
|
[
"Unlicense"
] | 2
|
2022-01-26T11:13:38.000Z
|
2022-02-22T21:18:30.000Z
|
Assignments/Assignment_03/ekf/utils/check_array.py
|
chrstrom/TTK4250
|
f453c3a59597d3fe6cff7d35b790689919798b94
|
[
"Unlicense"
] | 42
|
2022-01-25T17:10:43.000Z
|
2022-03-29T18:41:34.000Z
|
Assignments/Assignment_03/ekf/utils/check_array.py
|
chrstrom/TTK4250
|
f453c3a59597d3fe6cff7d35b790689919798b94
|
[
"Unlicense"
] | null | null | null |
import numpy as np
def isPSD(arr: np.ndarray) -> bool:
return np.allclose(arr, arr.T) and np.all(np.linalg.eigvals(arr) >= 0)
| 26.2
| 74
| 0.679389
| 24
| 131
| 3.708333
| 0.708333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009091
| 0.160305
| 131
| 4
| 75
| 32.75
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 6
|
3366ae2b5ef10f8a42bd01040ead69e70fa816f8
| 160
|
py
|
Python
|
subbreaker/__init__.py
|
healym3/SubstitutionBreaker
|
8507179a30c0f2f31e90535110726574159db7f7
|
[
"MIT"
] | null | null | null |
subbreaker/__init__.py
|
healym3/SubstitutionBreaker
|
8507179a30c0f2f31e90535110726574159db7f7
|
[
"MIT"
] | null | null | null |
subbreaker/__init__.py
|
healym3/SubstitutionBreaker
|
8507179a30c0f2f31e90535110726574159db7f7
|
[
"MIT"
] | null | null | null |
from subbreaker.key import Key
from subbreaker.breaker import Breaker, BreakerResult, BreakerInfo
__all__ = ["Key", "Breaker", "BreakerResult", "BreakerInfo"]
| 32
| 66
| 0.78125
| 17
| 160
| 7.117647
| 0.470588
| 0.231405
| 0.512397
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.10625
| 160
| 4
| 67
| 40
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0.2125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
6855914c8c0781636444f71e0676d1538976c161
| 80
|
py
|
Python
|
Python/VasyaTheHipster.py
|
Zardosh/code-forces-solutions
|
ea1446b8e4f391f3e9ef63094816c7bdaded1557
|
[
"MIT"
] | null | null | null |
Python/VasyaTheHipster.py
|
Zardosh/code-forces-solutions
|
ea1446b8e4f391f3e9ef63094816c7bdaded1557
|
[
"MIT"
] | null | null | null |
Python/VasyaTheHipster.py
|
Zardosh/code-forces-solutions
|
ea1446b8e4f391f3e9ef63094816c7bdaded1557
|
[
"MIT"
] | null | null | null |
a, b = map(int, input().split())
print(min(a, b), (max(a, b) - min(a, b)) // 2)
| 26.666667
| 46
| 0.4875
| 17
| 80
| 2.294118
| 0.588235
| 0.205128
| 0.25641
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015152
| 0.175
| 80
| 3
| 46
| 26.666667
| 0.575758
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 6
|
687ca5a3a4a3121f0828e6d8307eaad0d490be85
| 7,253
|
py
|
Python
|
lymph/test_anallyze.py
|
shifvb/GraduationProject
|
08166b49c329014bf852faafa14db14a6231370a
|
[
"MIT"
] | 1
|
2018-04-27T15:25:01.000Z
|
2018-04-27T15:25:01.000Z
|
lymph/test_anallyze.py
|
shifvb/Undergraduate_GraduationProject
|
08166b49c329014bf852faafa14db14a6231370a
|
[
"MIT"
] | null | null | null |
lymph/test_anallyze.py
|
shifvb/Undergraduate_GraduationProject
|
08166b49c329014bf852faafa14db14a6231370a
|
[
"MIT"
] | null | null | null |
import matplotlib.pyplot as plt
s = """[DEBUG] i=0, loss=28.609, accuracy=0.000 loss=11.049, accuracy=0.130
[DEBUG] i=10, loss=6.586, accuracy=0.350 loss=14.784, accuracy=0.033
[DEBUG] i=20, loss=5.510, accuracy=0.300 loss=9.616, accuracy=0.098
[DEBUG] i=30, loss=2.327, accuracy=0.550 loss=8.296, accuracy=0.109
[DEBUG] i=40, loss=1.043, accuracy=0.650 loss=9.919, accuracy=0.043
[DEBUG] i=50, loss=0.945, accuracy=0.650 loss=9.753, accuracy=0.043
[DEBUG] i=60, loss=6.082, accuracy=0.550 loss=9.287, accuracy=0.011
[DEBUG] i=70, loss=1.676, accuracy=0.700 loss=8.203, accuracy=0.011
[DEBUG] i=80, loss=3.853, accuracy=0.350 loss=7.978, accuracy=0.022
[DEBUG] i=90, loss=0.815, accuracy=0.700 loss=10.759, accuracy=0.000
[DEBUG] i=100, loss=1.476, accuracy=0.450 loss=8.099, accuracy=0.000
[DEBUG] i=110, loss=1.542, accuracy=0.500 loss=7.032, accuracy=0.022
[DEBUG] i=120, loss=0.864, accuracy=0.750 loss=7.523, accuracy=0.000
[DEBUG] i=130, loss=1.220, accuracy=0.650 loss=7.343, accuracy=0.011
[DEBUG] i=140, loss=1.321, accuracy=0.450 loss=7.344, accuracy=0.011
[DEBUG] i=150, loss=1.877, accuracy=0.500 loss=5.584, accuracy=0.033
[DEBUG] i=160, loss=1.501, accuracy=0.500 loss=6.347, accuracy=0.011
[DEBUG] i=170, loss=1.401, accuracy=0.600 loss=6.314, accuracy=0.022
[DEBUG] i=180, loss=1.301, accuracy=0.600 loss=8.552, accuracy=0.000
[DEBUG] i=190, loss=1.162, accuracy=0.550 loss=6.863, accuracy=0.011
[DEBUG] i=200, loss=1.044, accuracy=0.600 loss=5.250, accuracy=0.043
[DEBUG] i=210, loss=0.971, accuracy=0.500 loss=6.634, accuracy=0.011
[DEBUG] i=220, loss=1.243, accuracy=0.550 loss=6.893, accuracy=0.000
[DEBUG] i=230, loss=1.051, accuracy=0.550 loss=7.515, accuracy=0.000
[DEBUG] i=240, loss=1.677, accuracy=0.650 loss=7.700, accuracy=0.000
[DEBUG] i=250, loss=0.751, accuracy=0.750 loss=5.923, accuracy=0.011
[DEBUG] i=260, loss=0.575, accuracy=0.750 loss=7.619, accuracy=0.000
[DEBUG] i=270, loss=1.729, accuracy=0.250 loss=4.914, accuracy=0.043
[DEBUG] i=280, loss=0.780, accuracy=0.700 loss=7.619, accuracy=0.000
[DEBUG] i=290, loss=1.139, accuracy=0.700 loss=6.833, accuracy=0.000
[DEBUG] i=300, loss=0.602, accuracy=0.800 loss=7.246, accuracy=0.000
[DEBUG] i=310, loss=1.052, accuracy=0.550 loss=7.078, accuracy=0.000
[DEBUG] i=320, loss=1.110, accuracy=0.700 loss=6.108, accuracy=0.000
[DEBUG] i=330, loss=0.757, accuracy=0.650 loss=7.097, accuracy=0.000
[DEBUG] i=340, loss=1.075, accuracy=0.500 loss=5.403, accuracy=0.043
[DEBUG] i=350, loss=0.822, accuracy=0.800 loss=7.556, accuracy=0.000
[DEBUG] i=360, loss=0.662, accuracy=0.850 loss=7.143, accuracy=0.000
[DEBUG] i=370, loss=1.211, accuracy=0.600 loss=7.656, accuracy=0.000
[DEBUG] i=380, loss=0.947, accuracy=0.650 loss=6.132, accuracy=0.000
[DEBUG] i=390, loss=1.178, accuracy=0.600 loss=8.606, accuracy=0.000
[DEBUG] i=400, loss=0.721, accuracy=0.800 loss=6.595, accuracy=0.000
[DEBUG] i=410, loss=0.928, accuracy=0.600 loss=6.638, accuracy=0.000
[DEBUG] i=420, loss=0.882, accuracy=0.700 loss=8.227, accuracy=0.000
[DEBUG] i=430, loss=0.950, accuracy=0.600 loss=7.692, accuracy=0.000
[DEBUG] i=440, loss=0.656, accuracy=0.750 loss=6.579, accuracy=0.000
[DEBUG] i=450, loss=0.696, accuracy=0.700 loss=7.569, accuracy=0.000
[DEBUG] i=460, loss=1.237, accuracy=0.500 loss=6.852, accuracy=0.000
[DEBUG] i=470, loss=1.042, accuracy=0.650 loss=5.905, accuracy=0.011
[DEBUG] i=480, loss=1.045, accuracy=0.700 loss=9.507, accuracy=0.000
[DEBUG] i=490, loss=0.835, accuracy=0.700 loss=6.978, accuracy=0.000
[DEBUG] i=500, loss=0.647, accuracy=0.700 loss=5.110, accuracy=0.033
[DEBUG] i=510, loss=0.713, accuracy=0.750 loss=5.993, accuracy=0.000
[DEBUG] i=520, loss=0.600, accuracy=0.700 loss=8.024, accuracy=0.000
[DEBUG] i=530, loss=0.747, accuracy=0.700 loss=6.485, accuracy=0.000
[DEBUG] i=540, loss=0.575, accuracy=0.800 loss=7.991, accuracy=0.000
[DEBUG] i=550, loss=0.496, accuracy=0.850 loss=6.538, accuracy=0.000
[DEBUG] i=560, loss=0.797, accuracy=0.650 loss=6.885, accuracy=0.000
[DEBUG] i=570, loss=0.737, accuracy=0.800 loss=7.661, accuracy=0.000
[DEBUG] i=580, loss=0.701, accuracy=0.750 loss=9.460, accuracy=0.000
[DEBUG] i=590, loss=0.695, accuracy=0.750 loss=6.543, accuracy=0.011
[DEBUG] i=600, loss=1.030, accuracy=0.700 loss=8.976, accuracy=0.000
[DEBUG] i=610, loss=0.840, accuracy=0.700 loss=6.577, accuracy=0.000
[DEBUG] i=620, loss=0.596, accuracy=0.900 loss=6.719, accuracy=0.011
[DEBUG] i=630, loss=1.093, accuracy=0.700 loss=7.559, accuracy=0.000
[DEBUG] i=640, loss=0.543, accuracy=0.800 loss=6.828, accuracy=0.000
[DEBUG] i=650, loss=1.241, accuracy=0.500 loss=5.949, accuracy=0.011
[DEBUG] i=660, loss=1.035, accuracy=0.600 loss=6.366, accuracy=0.000
[DEBUG] i=670, loss=1.511, accuracy=0.350 loss=6.979, accuracy=0.000
[DEBUG] i=680, loss=0.929, accuracy=0.650 loss=7.800, accuracy=0.000
[DEBUG] i=690, loss=0.657, accuracy=0.750 loss=7.476, accuracy=0.000
[DEBUG] i=700, loss=0.687, accuracy=0.600 loss=8.014, accuracy=0.000
[DEBUG] i=710, loss=0.528, accuracy=0.800 loss=9.902, accuracy=0.000
[DEBUG] i=720, loss=1.127, accuracy=0.450 loss=5.689, accuracy=0.033
[DEBUG] i=730, loss=0.523, accuracy=0.900 loss=8.898, accuracy=0.000
[DEBUG] i=740, loss=0.485, accuracy=0.800 loss=6.411, accuracy=0.011
[DEBUG] i=750, loss=0.810, accuracy=0.650 loss=6.835, accuracy=0.000
[DEBUG] i=760, loss=0.964, accuracy=0.650 loss=7.563, accuracy=0.000
[DEBUG] i=770, loss=0.749, accuracy=0.700 loss=7.339, accuracy=0.000
[DEBUG] i=780, loss=1.196, accuracy=0.600 loss=8.418, accuracy=0.000
[DEBUG] i=790, loss=0.640, accuracy=0.800 loss=7.573, accuracy=0.000
[DEBUG] i=800, loss=0.618, accuracy=0.700 loss=7.630, accuracy=0.011
[DEBUG] i=810, loss=0.790, accuracy=0.700 loss=9.899, accuracy=0.000
[DEBUG] i=820, loss=0.630, accuracy=0.650 loss=8.292, accuracy=0.000
[DEBUG] i=830, loss=0.743, accuracy=0.700 loss=9.370, accuracy=0.000
[DEBUG] i=840, loss=0.806, accuracy=0.700 loss=6.484, accuracy=0.011
[DEBUG] i=850, loss=0.850, accuracy=0.650 loss=8.341, accuracy=0.000
[DEBUG] i=860, loss=0.534, accuracy=0.850 loss=5.385, accuracy=0.011
[DEBUG] i=870, loss=0.785, accuracy=0.700 loss=5.699, accuracy=0.011
[DEBUG] i=880, loss=0.589, accuracy=0.650 loss=6.338, accuracy=0.000
[DEBUG] i=890, loss=0.412, accuracy=0.900 loss=6.679, accuracy=0.000
[DEBUG] i=900, loss=1.154, accuracy=0.600 loss=7.733, accuracy=0.000
[DEBUG] i=910, loss=0.510, accuracy=0.800 loss=8.551, accuracy=0.000
[DEBUG] i=920, loss=0.708, accuracy=0.750 loss=7.145, accuracy=0.000
[DEBUG] i=930, loss=0.435, accuracy=0.850 loss=6.951, accuracy=0.000
[DEBUG] i=940, loss=0.543, accuracy=0.800 loss=6.174, accuracy=0.011
[DEBUG] i=950, loss=0.830, accuracy=0.650 loss=7.033, accuracy=0.000
[DEBUG] i=960, loss=0.978, accuracy=0.600 loss=6.797, accuracy=0.000
[DEBUG] i=970, loss=0.986, accuracy=0.650 loss=6.802, accuracy=0.011
[DEBUG] i=980, loss=0.470, accuracy=0.750 loss=7.772, accuracy=0.000
[DEBUG] i=990, loss=0.771, accuracy=0.550 loss=7.177, accuracy=0.000"""
s = s.split("\n")
assert len(s) == 100, len(s)
s.sort(key=lambda x: float(x.split(" ")[4].split("=")[1].rstrip(",")))
for x in s:
print(x)
x = list(map(lambda _x: int(_x.split(" ")[1].split("=")[1].rstrip(",")), s))
y = list(map(lambda _x: float(_x.split(" ")[5].split("=")[1]), s))
plt.scatter(x, y)
plt.show()
| 64.185841
| 76
| 0.702192
| 1,565
| 7,253
| 3.251757
| 0.199361
| 0.353704
| 0.157988
| 0.217135
| 0.618
| 0.020043
| 0.020043
| 0.020043
| 0
| 0
| 0
| 0.287876
| 0.089067
| 7,253
| 112
| 77
| 64.758929
| 0.482367
| 0
| 0
| 0
| 0
| 0.909091
| 0.951606
| 0
| 0
| 0
| 0
| 0
| 0.009091
| 1
| 0
| false
| 0
| 0.009091
| 0
| 0.009091
| 0.009091
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
68a1ecd40dd5dfdc52d17eb73d8bd0dc428b7971
| 54,994
|
py
|
Python
|
tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py
|
awickens/libcellml
|
1fe0aecc9651285dfa6b9d43c0b45edf1378edf5
|
[
"Apache-2.0"
] | 1
|
2020-11-16T05:43:00.000Z
|
2020-11-16T05:43:00.000Z
|
tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py
|
awickens/libcellml
|
1fe0aecc9651285dfa6b9d43c0b45edf1378edf5
|
[
"Apache-2.0"
] | 16
|
2019-11-29T11:36:30.000Z
|
2021-03-08T23:59:14.000Z
|
tests/resources/generator/fabbri_fantini_wilders_severi_human_san_model_2017/model.py
|
kerimoyle/libcellml
|
63b677e4b22c28a7dcb69513df1495f0f8eccefa
|
[
"Apache-2.0"
] | null | null | null |
# The content of this file was generated using the Python profile of libCellML 0.2.0.
from enum import Enum
from math import *
__version__ = "0.2.0"
LIBCELLML_VERSION = "0.2.0"
STATE_COUNT = 33
VARIABLE_COUNT = 217
class VariableType(Enum):
CONSTANT = 1
COMPUTED_CONSTANT = 2
ALGEBRAIC = 3
VOI_INFO = {"name": "time", "units": "second", "component": "environment"}
STATE_INFO = [
{"name": "R", "units": "dimensionless", "component": "Ca_SR_release"},
{"name": "O", "units": "dimensionless", "component": "Ca_SR_release"},
{"name": "I", "units": "dimensionless", "component": "Ca_SR_release"},
{"name": "RI", "units": "dimensionless", "component": "Ca_SR_release"},
{"name": "Ca_jsr", "units": "millimolar", "component": "Ca_dynamics"},
{"name": "fCa", "units": "dimensionless", "component": "i_CaL_fCa_gate"},
{"name": "fTC", "units": "dimensionless", "component": "Ca_buffering"},
{"name": "fTMC", "units": "dimensionless", "component": "Ca_buffering"},
{"name": "fTMM", "units": "dimensionless", "component": "Ca_buffering"},
{"name": "fCMi", "units": "dimensionless", "component": "Ca_buffering"},
{"name": "fCMs", "units": "dimensionless", "component": "Ca_buffering"},
{"name": "fCQ", "units": "dimensionless", "component": "Ca_buffering"},
{"name": "Cai", "units": "millimolar", "component": "Ca_dynamics"},
{"name": "Ca_nsr", "units": "millimolar", "component": "Ca_dynamics"},
{"name": "y", "units": "dimensionless", "component": "i_f_y_gate"},
{"name": "m", "units": "dimensionless", "component": "i_Na_m_gate"},
{"name": "h", "units": "dimensionless", "component": "i_Na_h_gate"},
{"name": "fL", "units": "dimensionless", "component": "i_CaL_fL_gate"},
{"name": "dT", "units": "dimensionless", "component": "i_CaT_dT_gate"},
{"name": "fT", "units": "dimensionless", "component": "i_CaT_fT_gate"},
{"name": "q", "units": "dimensionless", "component": "i_to_q_gate"},
{"name": "r", "units": "dimensionless", "component": "i_to_r_gate"},
{"name": "paS", "units": "dimensionless", "component": "i_Kr_pa_gate"},
{"name": "paF", "units": "dimensionless", "component": "i_Kr_pa_gate"},
{"name": "piy", "units": "dimensionless", "component": "i_Kr_pi_gate"},
{"name": "a", "units": "dimensionless", "component": "i_KACh_a_gate"},
{"name": "r_Kur", "units": "dimensionless", "component": "i_Kur_rKur_gate"},
{"name": "s_Kur", "units": "dimensionless", "component": "i_Kur_sKur_gate"},
{"name": "n", "units": "dimensionless", "component": "i_Ks_n_gate"},
{"name": "dL", "units": "dimensionless", "component": "i_CaL_dL_gate"},
{"name": "Ca_sub", "units": "millimolar", "component": "Ca_dynamics"},
{"name": "V_ode", "units": "millivolt", "component": "Membrane"},
{"name": "Nai_", "units": "millimolar", "component": "Nai_concentration"}
]
VARIABLE_INFO = [
{"name": "EC50_SR", "units": "millimolar", "component": "Ca_SR_release", "type": VariableType.CONSTANT},
{"name": "HSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.CONSTANT},
{"name": "MaxSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.CONSTANT},
{"name": "MinSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.CONSTANT},
{"name": "kiCa", "units": "per_millimolar_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT},
{"name": "kim", "units": "per_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT},
{"name": "koCa", "units": "per_millimolar2_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT},
{"name": "kom", "units": "per_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT},
{"name": "ks", "units": "per_second", "component": "Ca_SR_release", "type": VariableType.CONSTANT},
{"name": "CM_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "CQ_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "Mgi", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "TC_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "TMC_tot", "units": "millimolar", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "kb_CM", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "kb_CQ", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "kb_TC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "kb_TMC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "kb_TMM", "units": "per_second", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "kf_CM", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "kf_CQ", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "kf_TC", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "kf_TMC", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "kf_TMM", "units": "per_millimolar_second", "component": "Ca_buffering", "type": VariableType.CONSTANT},
{"name": "K_up", "units": "millimolar", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT},
{"name": "P_up_basal", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT},
{"name": "slope_up", "units": "millimolar", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT},
{"name": "tau_dif_Ca", "units": "second", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT},
{"name": "tau_tr", "units": "second", "component": "Ca_intracellular_fluxes", "type": VariableType.CONSTANT},
{"name": "L_cell", "units": "micrometre", "component": "Cell_parameters", "type": VariableType.CONSTANT},
{"name": "L_sub", "units": "micrometre", "component": "Cell_parameters", "type": VariableType.CONSTANT},
{"name": "R_cell", "units": "micrometre", "component": "Cell_parameters", "type": VariableType.CONSTANT},
{"name": "V_i_part", "units": "dimensionless", "component": "Cell_parameters", "type": VariableType.CONSTANT},
{"name": "V_jsr_part", "units": "dimensionless", "component": "Cell_parameters", "type": VariableType.CONSTANT},
{"name": "V_nsr_part", "units": "dimensionless", "component": "Cell_parameters", "type": VariableType.CONSTANT},
{"name": "Cao", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT},
{"name": "Ki", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT},
{"name": "Ko", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT},
{"name": "Nao", "units": "millimolar", "component": "Ionic_values", "type": VariableType.CONSTANT},
{"name": "C", "units": "microF", "component": "Membrane", "type": VariableType.CONSTANT},
{"name": "F", "units": "coulomb_per_mole", "component": "Membrane", "type": VariableType.CONSTANT},
{"name": "R", "units": "joule_per_kilomole_kelvin", "component": "Membrane", "type": VariableType.CONSTANT},
{"name": "T", "units": "kelvin", "component": "Membrane", "type": VariableType.CONSTANT},
{"name": "clamp_mode", "units": "dimensionless", "component": "Membrane", "type": VariableType.CONSTANT},
{"name": "Nai_clamp", "units": "dimensionless", "component": "Nai_concentration", "type": VariableType.CONSTANT},
{"name": "ACh", "units": "millimolar", "component": "Rate_modulation_experiments", "type": VariableType.CONSTANT},
{"name": "Iso_1_uM", "units": "dimensionless", "component": "Rate_modulation_experiments", "type": VariableType.CONSTANT},
{"name": "V_holding", "units": "millivolt", "component": "Voltage_clamp", "type": VariableType.CONSTANT},
{"name": "V_test", "units": "millivolt", "component": "Voltage_clamp", "type": VariableType.CONSTANT},
{"name": "t_holding", "units": "second", "component": "Voltage_clamp", "type": VariableType.CONSTANT},
{"name": "t_test", "units": "second", "component": "Voltage_clamp", "type": VariableType.CONSTANT},
{"name": "P_CaL", "units": "nanoA_per_millimolar", "component": "i_CaL", "type": VariableType.CONSTANT},
{"name": "V_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.CONSTANT},
{"name": "k_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.CONSTANT},
{"name": "Km_fCa", "units": "millimolar", "component": "i_CaL_fCa_gate", "type": VariableType.CONSTANT},
{"name": "alpha_fCa", "units": "per_second", "component": "i_CaL_fCa_gate", "type": VariableType.CONSTANT},
{"name": "k_fL", "units": "millivolt", "component": "i_CaL_fL_gate", "type": VariableType.CONSTANT},
{"name": "shift_fL", "units": "millivolt", "component": "i_CaL_fL_gate", "type": VariableType.CONSTANT},
{"name": "P_CaT", "units": "nanoA_per_millimolar", "component": "i_CaT", "type": VariableType.CONSTANT},
{"name": "offset_fT", "units": "second", "component": "i_CaT_fT_gate", "type": VariableType.CONSTANT},
{"name": "ACh_on", "units": "dimensionless", "component": "i_KACh", "type": VariableType.CONSTANT},
{"name": "g_KACh", "units": "microS", "component": "i_KACh", "type": VariableType.CONSTANT},
{"name": "g_Kr", "units": "microS", "component": "i_Kr", "type": VariableType.CONSTANT},
{"name": "g_Ks_", "units": "microS", "component": "i_Ks", "type": VariableType.CONSTANT},
{"name": "g_Kur", "units": "microS", "component": "i_Kur", "type": VariableType.CONSTANT},
{"name": "g_Na", "units": "microS", "component": "i_Na", "type": VariableType.CONSTANT},
{"name": "g_Na_L", "units": "microS", "component": "i_Na", "type": VariableType.CONSTANT},
{"name": "K1ni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "K1no", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "K2ni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "K2no", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "K3ni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "K3no", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "K_NaCa", "units": "nanoA", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "Kci", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "Kcni", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "Kco", "units": "millimolar", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "Qci", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "Qco", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "Qn", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "blockade_NaCa", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.CONSTANT},
{"name": "Km_Kp", "units": "millimolar", "component": "i_NaK", "type": VariableType.CONSTANT},
{"name": "Km_Nap", "units": "millimolar", "component": "i_NaK", "type": VariableType.CONSTANT},
{"name": "i_NaK_max", "units": "nanoA", "component": "i_NaK", "type": VariableType.CONSTANT},
{"name": "delta_m", "units": "millivolt", "component": "i_Na_m_gate", "type": VariableType.CONSTANT},
{"name": "Km_f", "units": "millimolar", "component": "i_f", "type": VariableType.CONSTANT},
{"name": "alpha", "units": "dimensionless", "component": "i_f", "type": VariableType.CONSTANT},
{"name": "blockade", "units": "dimensionless", "component": "i_f", "type": VariableType.CONSTANT},
{"name": "g_f", "units": "microS", "component": "i_f", "type": VariableType.CONSTANT},
{"name": "y_shift", "units": "millivolt", "component": "i_f_y_gate", "type": VariableType.CONSTANT},
{"name": "g_to", "units": "microS", "component": "i_to", "type": VariableType.CONSTANT},
{"name": "Nai", "units": "millimolar", "component": "Nai_concentration", "type": VariableType.ALGEBRAIC},
{"name": "Iso_increase", "units": "dimensionless", "component": "i_NaK", "type": VariableType.COMPUTED_CONSTANT},
{"name": "k43", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "k34", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.COMPUTED_CONSTANT},
{"name": "j_SRCarel", "units": "millimolar_per_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC},
{"name": "diff", "units": "millimolar", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC},
{"name": "kCaSR", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC},
{"name": "koSRCa", "units": "per_millimolar2_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC},
{"name": "kiSRCa", "units": "per_millimolar_second", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC},
{"name": "P_tot", "units": "dimensionless", "component": "Ca_SR_release", "type": VariableType.ALGEBRAIC},
{"name": "b_up", "units": "dimensionless", "component": "Ca_intracellular_fluxes", "type": VariableType.COMPUTED_CONSTANT},
{"name": "P_up", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.COMPUTED_CONSTANT},
{"name": "j_Ca_dif", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC},
{"name": "j_up", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC},
{"name": "j_tr", "units": "millimolar_per_second", "component": "Ca_intracellular_fluxes", "type": VariableType.ALGEBRAIC},
{"name": "delta_fTC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC},
{"name": "delta_fTMC", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC},
{"name": "delta_fTMM", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC},
{"name": "delta_fCMi", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC},
{"name": "delta_fCMs", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC},
{"name": "delta_fCQ", "units": "per_second", "component": "Ca_buffering", "type": VariableType.ALGEBRAIC},
{"name": "V_cell", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT},
{"name": "V_sub", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT},
{"name": "V_jsr", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT},
{"name": "V_i", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT},
{"name": "V_nsr", "units": "millimetre3", "component": "Cell_parameters", "type": VariableType.COMPUTED_CONSTANT},
{"name": "RTONF", "units": "millivolt", "component": "Membrane", "type": VariableType.COMPUTED_CONSTANT},
{"name": "V_clamp", "units": "millivolt", "component": "Voltage_clamp", "type": VariableType.ALGEBRAIC},
{"name": "G_f", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT},
{"name": "G_f_K", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT},
{"name": "G_f_Na", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT},
{"name": "g_f_Na", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT},
{"name": "g_f_K", "units": "microS", "component": "i_f", "type": VariableType.COMPUTED_CONSTANT},
{"name": "ACh_shift", "units": "millivolt", "component": "i_f_y_gate", "type": VariableType.COMPUTED_CONSTANT},
{"name": "Iso_shift", "units": "millivolt", "component": "i_f_y_gate", "type": VariableType.COMPUTED_CONSTANT},
{"name": "E_mh", "units": "millivolt", "component": "i_Na", "type": VariableType.ALGEBRAIC},
{"name": "Iso_increase", "units": "dimensionless", "component": "i_CaL", "type": VariableType.COMPUTED_CONSTANT},
{"name": "ACh_block", "units": "dimensionless", "component": "i_CaL", "type": VariableType.COMPUTED_CONSTANT},
{"name": "Iso_shift_dL", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.COMPUTED_CONSTANT},
{"name": "Iso_slope_dL", "units": "dimensionless", "component": "i_CaL_dL_gate", "type": VariableType.COMPUTED_CONSTANT},
{"name": "fCa_infinity", "units": "dimensionless", "component": "i_CaL_fCa_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_fCa", "units": "second", "component": "i_CaL_fCa_gate", "type": VariableType.ALGEBRAIC},
{"name": "g_Ks", "units": "microS", "component": "i_Ks", "type": VariableType.COMPUTED_CONSTANT},
{"name": "E_Ks", "units": "millivolt", "component": "i_Ks", "type": VariableType.ALGEBRAIC},
{"name": "Iso_shift", "units": "millivolt", "component": "i_Ks_n_gate", "type": VariableType.COMPUTED_CONSTANT},
{"name": "alpha_a", "units": "per_second", "component": "i_KACh_a_gate", "type": VariableType.COMPUTED_CONSTANT},
{"name": "E_Na", "units": "millivolt", "component": "Ionic_values", "type": VariableType.ALGEBRAIC},
{"name": "E_K", "units": "millivolt", "component": "Ionic_values", "type": VariableType.COMPUTED_CONSTANT},
{"name": "E_Ca", "units": "millivolt", "component": "Ionic_values", "type": VariableType.ALGEBRAIC},
{"name": "V", "units": "millivolt", "component": "Membrane", "type": VariableType.ALGEBRAIC},
{"name": "i_fNa", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC},
{"name": "i_fK", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC},
{"name": "i_f", "units": "nanoA", "component": "i_f", "type": VariableType.ALGEBRAIC},
{"name": "tau_y", "units": "second", "component": "i_f_y_gate", "type": VariableType.ALGEBRAIC},
{"name": "y_infinity", "units": "dimensionless", "component": "i_f_y_gate", "type": VariableType.ALGEBRAIC},
{"name": "i_Na_", "units": "nanoA", "component": "i_Na", "type": VariableType.ALGEBRAIC},
{"name": "i_Na_L", "units": "nanoA", "component": "i_Na", "type": VariableType.ALGEBRAIC},
{"name": "i_Na", "units": "nanoA", "component": "i_Na", "type": VariableType.ALGEBRAIC},
{"name": "m_infinity", "units": "dimensionless", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC},
{"name": "E0_m", "units": "millivolt", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC},
{"name": "alpha_m", "units": "per_second", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC},
{"name": "beta_m", "units": "per_second", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_m", "units": "second", "component": "i_Na_m_gate", "type": VariableType.ALGEBRAIC},
{"name": "h_infinity", "units": "dimensionless", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC},
{"name": "alpha_h", "units": "per_second", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC},
{"name": "beta_h", "units": "per_second", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_h", "units": "second", "component": "i_Na_h_gate", "type": VariableType.ALGEBRAIC},
{"name": "i_Kur", "units": "nanoA", "component": "i_Kur", "type": VariableType.ALGEBRAIC},
{"name": "r_Kur_infinity", "units": "dimensionless", "component": "i_Kur_rKur_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_r_Kur", "units": "second", "component": "i_Kur_rKur_gate", "type": VariableType.ALGEBRAIC},
{"name": "s_Kur_infinity", "units": "dimensionless", "component": "i_Kur_sKur_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_s_Kur", "units": "second", "component": "i_Kur_sKur_gate", "type": VariableType.ALGEBRAIC},
{"name": "i_siCa", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC},
{"name": "i_siK", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC},
{"name": "i_siNa", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC},
{"name": "i_CaL", "units": "nanoA", "component": "i_CaL", "type": VariableType.ALGEBRAIC},
{"name": "dL_infinity", "units": "dimensionless", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC},
{"name": "adVm", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC},
{"name": "bdVm", "units": "millivolt", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC},
{"name": "fL_infinity", "units": "dimensionless", "component": "i_CaL_fL_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_fL", "units": "second", "component": "i_CaL_fL_gate", "type": VariableType.ALGEBRAIC},
{"name": "i_CaT", "units": "nanoA", "component": "i_CaT", "type": VariableType.ALGEBRAIC},
{"name": "dT_infinity", "units": "dimensionless", "component": "i_CaT_dT_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_dT", "units": "second", "component": "i_CaT_dT_gate", "type": VariableType.ALGEBRAIC},
{"name": "fT_infinity", "units": "dimensionless", "component": "i_CaT_fT_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_fT", "units": "second", "component": "i_CaT_fT_gate", "type": VariableType.ALGEBRAIC},
{"name": "i_to", "units": "nanoA", "component": "i_to", "type": VariableType.ALGEBRAIC},
{"name": "q_infinity", "units": "dimensionless", "component": "i_to_q_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_q", "units": "second", "component": "i_to_q_gate", "type": VariableType.ALGEBRAIC},
{"name": "r_infinity", "units": "dimensionless", "component": "i_to_r_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_r", "units": "second", "component": "i_to_r_gate", "type": VariableType.ALGEBRAIC},
{"name": "i_Kr", "units": "nanoA", "component": "i_Kr", "type": VariableType.ALGEBRAIC},
{"name": "alfapaF", "units": "per_second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC},
{"name": "betapaF", "units": "per_second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC},
{"name": "pa_infinity", "units": "dimensionless", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_paS", "units": "second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_paF", "units": "second", "component": "i_Kr_pa_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_pi", "units": "second", "component": "i_Kr_pi_gate", "type": VariableType.ALGEBRAIC},
{"name": "pi_infinity", "units": "dimensionless", "component": "i_Kr_pi_gate", "type": VariableType.ALGEBRAIC},
{"name": "i_Ks", "units": "nanoA", "component": "i_Ks", "type": VariableType.ALGEBRAIC},
{"name": "n_infinity", "units": "dimensionless", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC},
{"name": "alpha_n", "units": "per_second", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC},
{"name": "beta_n", "units": "per_second", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC},
{"name": "i_KACh", "units": "nanoA", "component": "i_KACh", "type": VariableType.ALGEBRAIC},
{"name": "beta_a", "units": "per_second", "component": "i_KACh_a_gate", "type": VariableType.ALGEBRAIC},
{"name": "a_infinity", "units": "dimensionless", "component": "i_KACh_a_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_a", "units": "second", "component": "i_KACh_a_gate", "type": VariableType.ALGEBRAIC},
{"name": "i_NaK", "units": "nanoA", "component": "i_NaK", "type": VariableType.ALGEBRAIC},
{"name": "k41", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "di", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "k32", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "do", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "alpha_dL", "units": "per_second", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC},
{"name": "beta_dL", "units": "per_second", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC},
{"name": "tau_n", "units": "second", "component": "i_Ks_n_gate", "type": VariableType.ALGEBRAIC},
{"name": "k12", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "k14", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "k21", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "k23", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "tau_dL", "units": "second", "component": "i_CaL_dL_gate", "type": VariableType.ALGEBRAIC},
{"name": "x1", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "x2", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "x3", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "x4", "units": "dimensionless", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "i_NaCa", "units": "nanoA", "component": "i_NaCa", "type": VariableType.ALGEBRAIC},
{"name": "i_tot", "units": "nanoA", "component": "Membrane", "type": VariableType.ALGEBRAIC}
]
def eq_func(x, y):
return 1.0 if x == y else 0.0
def lt_func(x, y):
return 1.0 if x < y else 0.0
def gt_func(x, y):
return 1.0 if x > y else 0.0
def geq_func(x, y):
return 1.0 if x >= y else 0.0
def and_func(x, y):
return 1.0 if bool(x) & bool(y) else 0.0
def create_states_array():
return [nan]*STATE_COUNT
def create_variables_array():
return [nan]*VARIABLE_COUNT
def initialise_states_and_constants(states, variables):
variables[0] = 0.45
variables[1] = 2.5
variables[2] = 15.0
variables[3] = 1.0
variables[4] = 500.0
variables[5] = 5.0
variables[6] = 10000.0
variables[7] = 660.0
variables[8] = 148041085.1
variables[9] = 0.045
variables[10] = 10.0
variables[11] = 2.5
variables[12] = 0.031
variables[13] = 0.062
variables[14] = 542.0
variables[15] = 445.0
variables[16] = 446.0
variables[17] = 7.51
variables[18] = 751.0
variables[19] = 1.642e6
variables[20] = 175.4
variables[21] = 88800.0
variables[22] = 227700.0
variables[23] = 2277.0
variables[24] = 0.000286113
variables[25] = 5.0
variables[26] = 5.0e-5
variables[27] = 5.469e-5
variables[28] = 0.04
variables[29] = 67.0
variables[30] = 0.02
variables[31] = 3.9
variables[32] = 0.46
variables[33] = 0.0012
variables[34] = 0.0116
variables[35] = 1.8
variables[36] = 140.0
variables[37] = 5.4
variables[38] = 140.0
variables[39] = 5.7e-5
variables[40] = 96485.3415
variables[41] = 8314.472
variables[42] = 310.0
variables[43] = 0.0
variables[44] = 1.0
variables[45] = 0.0
variables[46] = 0.0
variables[47] = -45.0
variables[48] = -35.0
variables[49] = 0.5
variables[50] = 0.5
variables[51] = 0.4578
variables[52] = -16.4508
variables[53] = 4.3371
variables[54] = 0.000338
variables[55] = 0.0075
variables[56] = 0.0
variables[57] = 0.0
variables[58] = 0.04132
variables[59] = 0.0
variables[60] = 1.0
variables[61] = 0.00345
variables[62] = 0.00424
variables[63] = 0.00065
variables[64] = 0.1539e-3
variables[65] = 0.0223
variables[66] = 0.0
variables[67] = 395.3
variables[68] = 1628.0
variables[69] = 2.289
variables[70] = 561.4
variables[71] = 26.44
variables[72] = 4.663
variables[73] = 3.343
variables[74] = 0.0207
variables[75] = 26.44
variables[76] = 3.663
variables[77] = 0.1369
variables[78] = 0.0
variables[79] = 0.4315
variables[80] = 0.0
variables[81] = 1.4
variables[82] = 14.0
variables[83] = 0.08105
variables[84] = 1.0e-5
variables[85] = 45.0
variables[86] = 0.5927
variables[87] = 0.0
variables[88] = 0.00427
variables[89] = 0.0
variables[90] = 3.5e-3
states[0] = 0.9308
states[1] = 6.181512e-9
states[2] = 4.595622e-10
states[3] = 0.069199
states[4] = 0.409551
states[5] = 0.844449
states[6] = 0.017929
states[7] = 0.259947
states[8] = 0.653777
states[9] = 0.217311
states[10] = 0.158521
states[11] = 0.138975
states[12] = 9.15641e-6
states[13] = 0.435148
states[14] = 0.009508
states[15] = 0.447724
states[16] = 0.003058
states[17] = 0.846702
states[18] = 0.268909
states[19] = 0.020484
states[20] = 0.430836
states[21] = 0.014523
states[22] = 0.283185
states[23] = 0.011068
states[24] = 0.709051
states[25] = 0.00277
states[26] = 0.011845
states[27] = 0.845304
states[28] = 0.1162
states[29] = 0.001921
states[30] = 6.226104e-5
states[31] = -47.787168
states[32] = 5.0
def compute_computed_constants(variables):
variables[92] = 1.2 if gt_func(variables[46], 0.0) else 1.0
variables[94] = variables[38]/(variables[72]+variables[38])
variables[101] = -0.25 if gt_func(variables[46], 0.0) else 0.7*variables[45]/(0.00009+variables[45]) if gt_func(variables[45], 0.0) else 0.0
variables[102] = variables[25]*(1.0-variables[101])
variables[112] = 0.000000001*3.14159265358979*pow(variables[31], 2.0)*variables[29]
variables[113] = 0.000000001*2.0*3.14159265358979*variables[30]*(variables[31]-variables[30]/2.0)*variables[29]
variables[114] = variables[33]*variables[112]
variables[115] = variables[32]*variables[112]-variables[113]
variables[116] = variables[34]*variables[112]
variables[117] = variables[41]*variables[42]/variables[40]
variables[119] = variables[88]/(variables[37]/(variables[37]+variables[85]))
variables[120] = variables[119]/(variables[86]+1.0)
variables[121] = variables[86]*variables[120]
variables[122] = variables[121]*variables[37]/(variables[37]+variables[85])
variables[123] = variables[120]*variables[37]/(variables[37]+variables[85])
variables[124] = -1.0-9.898*pow(1.0*variables[45], 0.618)/(pow(1.0*variables[45], 0.618)+0.00122423) if gt_func(variables[45], 0.0) else 0.0
variables[125] = 7.5 if gt_func(variables[46], 0.0) else 0.0
variables[127] = 1.23 if gt_func(variables[46], 0.0) else 1.0
variables[128] = 0.31*variables[45]/(variables[45]+0.00009)
variables[129] = -8.0 if gt_func(variables[46], 0.0) else 0.0
variables[130] = -27.0 if gt_func(variables[46], 0.0) else 0.0
variables[133] = 1.2*variables[63] if gt_func(variables[46], 0.0) else variables[63]
variables[135] = -14.0 if gt_func(variables[46], 0.0) else 0.0
variables[136] = (3.5988-0.025641)/(1.0+0.0000012155/pow(1.0*variables[45], 1.6951))+0.025641
variables[138] = variables[117]*log(variables[37]/variables[36])
def compute_rates(voi, states, rates, variables):
variables[97] = variables[2]-(variables[2]-variables[3])/(1.0+pow(variables[0]/states[4], variables[1]))
variables[99] = variables[4]*variables[97]
variables[98] = variables[6]/variables[97]
rates[0] = variables[5]*states[3]-variables[99]*states[30]*states[0]-(variables[98]*pow(states[30], 2.0)*states[0]-variables[7]*states[1])
rates[1] = variables[98]*pow(states[30], 2.0)*states[0]-variables[7]*states[1]-(variables[99]*states[30]*states[1]-variables[5]*states[2])
rates[2] = variables[99]*states[30]*states[1]-variables[5]*states[2]-(variables[7]*states[2]-variables[98]*pow(states[30], 2.0)*states[3])
rates[3] = variables[7]*states[2]-variables[98]*pow(states[30], 2.0)*states[3]-(variables[5]*states[3]-variables[99]*states[30]*states[0])
variables[105] = (states[13]-states[4])/variables[28]
variables[95] = variables[8]*states[1]*(states[4]-states[30])
variables[111] = variables[20]*states[4]*(1.0-states[11])-variables[15]*states[11]
rates[4] = variables[105]-(variables[95]+variables[10]*variables[111])
variables[131] = variables[54]/(variables[54]+states[30])
variables[132] = 0.001*variables[131]/variables[55]
rates[5] = (variables[131]-states[5])/variables[132]
variables[106] = variables[21]*states[12]*(1.0-states[6])-variables[16]*states[6]
rates[6] = variables[106]
variables[107] = variables[22]*states[12]*(1.0-(states[7]+states[8]))-variables[17]*states[7]
rates[7] = variables[107]
variables[108] = variables[23]*variables[11]*(1.0-(states[7]+states[8]))-variables[18]*states[8]
rates[8] = variables[108]
variables[109] = variables[19]*states[12]*(1.0-states[9])-variables[14]*states[9]
rates[9] = variables[109]
variables[110] = variables[19]*states[30]*(1.0-states[10])-variables[14]*states[10]
rates[10] = variables[110]
rates[11] = variables[111]
variables[103] = (states[30]-states[12])/variables[27]
variables[104] = variables[102]/(1.0+exp((-states[12]+variables[24])/variables[26]))
rates[12] = 1.0*(variables[103]*variables[113]-variables[104]*variables[116])/variables[115]-(variables[9]*variables[109]+variables[12]*variables[106]+variables[13]*variables[107])
rates[13] = variables[104]-variables[105]*variables[114]/variables[116]
variables[118] = variables[48] if and_func(gt_func(voi, variables[49]), lt_func(voi, variables[49]+variables[50])) else variables[47]
variables[140] = variables[118] if geq_func(variables[43], 1.0) else states[31]
variables[145] = 0.01329+0.99921/(1.0+exp((variables[140]+97.134-variables[124]-variables[125]-variables[89])/8.1752)) if lt_func(variables[140], -(80.0-variables[124]-variables[125]-variables[89])) else 0.0002501*exp(-(variables[140]-variables[124]-variables[125]-variables[89])/12.861)
variables[144] = 1.0/(0.36*(variables[140]+148.8-variables[124]-variables[125])/(exp(0.066*(variables[140]+148.8-variables[124]-variables[125]))-1.0)+0.1*(variables[140]+87.3-variables[124]-variables[125])/(1.0-exp(-0.2*(variables[140]+87.3-variables[124]-variables[125]))))-0.054
rates[14] = (variables[145]-states[14])/variables[144]
variables[149] = 1.0/(1.0+exp(-(variables[140]+42.0504)/8.3106))
variables[150] = variables[140]+41.0
variables[151] = 2000.0 if lt_func(fabs(variables[150]), variables[84]) else 200.0*variables[150]/(1.0-exp(-0.1*variables[150]))
variables[152] = 8000.0*exp(-0.056*(variables[140]+66.0))
variables[153] = 1.0/(variables[151]+variables[152])
rates[15] = (variables[149]-states[15])/variables[153]
variables[154] = 1.0/(1.0+exp((variables[140]+69.804)/4.4565))
variables[155] = 20.0*exp(-0.125*(variables[140]+75.0))
variables[156] = 2000.0/(320.0*exp(-0.1*(variables[140]+75.0))+1.0)
variables[157] = 1.0/(variables[155]+variables[156])
rates[16] = (variables[154]-states[16])/variables[157]
variables[170] = 1.0/(1.0+exp((variables[140]+37.4+variables[57])/(5.3+variables[56])))
variables[171] = 0.001*(44.3+230.0*exp(-pow((variables[140]+36.0)/10.0, 2.0)))
rates[17] = (variables[170]-states[17])/variables[171]
variables[173] = 1.0/(1.0+exp(-(variables[140]+38.3)/5.5))
variables[174] = 0.001/(1.068*exp((variables[140]+38.3)/30.0)+1.068*exp(-(variables[140]+38.3)/30.0))
rates[18] = (variables[173]-states[18])/variables[174]
variables[175] = 1.0/(1.0+exp((variables[140]+58.7)/3.8))
variables[176] = 1.0/(16.67*exp(-(variables[140]+75.0)/83.3)+16.67*exp((variables[140]+75.0)/15.38))+variables[59]
rates[19] = (variables[175]-states[19])/variables[176]
variables[178] = 1.0/(1.0+exp((variables[140]+49.0)/13.0))
variables[179] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(variables[140]+44.0))+0.065*exp(0.1*(variables[140]+45.93)))+10.1)
rates[20] = (variables[178]-states[20])/variables[179]
variables[180] = 1.0/(1.0+exp(-(variables[140]-19.3)/15.0))
variables[181] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(variables[140]+30.61))+0.369*exp(-0.12*(variables[140]+23.84)))+2.98)
rates[21] = (variables[180]-states[21])/variables[181]
variables[185] = 1.0/(1.0+exp(-(variables[140]+10.0144)/7.6607))
variables[186] = 0.84655354/(4.2*exp(variables[140]/17.0)+0.15*exp(-variables[140]/21.6))
rates[22] = (variables[185]-states[22])/variables[186]
variables[187] = 1.0/(30.0*exp(variables[140]/10.0)+exp(-variables[140]/12.0))
rates[23] = (variables[185]-states[23])/variables[187]
variables[189] = 1.0/(1.0+exp((variables[140]+28.6)/17.1))
variables[188] = 1.0/(100.0*exp(-variables[140]/54.645)+656.0*exp(variables[140]/106.157))
rates[24] = (variables[189]-states[24])/variables[188]
variables[195] = 10.0*exp(0.0133*(variables[140]+40.0))
variables[196] = variables[136]/(variables[136]+variables[195])
variables[197] = 1.0/(variables[136]+variables[195])
rates[25] = (variables[196]-states[25])/variables[197]
variables[159] = 1.0/(1.0+exp((variables[140]+6.0)/-8.6))
variables[160] = 0.009/(1.0+exp((variables[140]+5.0)/12.0))+0.0005
rates[26] = (variables[159]-states[26])/variables[160]
variables[161] = 1.0/(1.0+exp((variables[140]+7.5)/10.0))
variables[162] = 0.59/(1.0+exp((variables[140]+60.0)/10.0))+3.05
rates[27] = (variables[161]-states[27])/variables[162]
variables[191] = sqrt(1.0/(1.0+exp(-(variables[140]+0.6383-variables[135])/10.7071)))
variables[192] = 28.0/(1.0+exp(-(variables[140]-40.0-variables[135])/3.0))
variables[193] = 1.0*exp(-(variables[140]-variables[135]-5.0)/25.0)
variables[205] = 1.0/(variables[192]+variables[193])
rates[28] = (variables[191]-states[28])/variables[205]
variables[167] = 1.0/(1.0+exp(-(variables[140]-variables[52]-variables[129])/(variables[53]*(1.0+variables[130]/100.0))))
variables[168] = -41.80001 if eq_func(variables[140], -41.8) else 0.0 if eq_func(variables[140], 0.0) else -6.80001 if eq_func(variables[140], -6.8) else variables[140]
variables[203] = -0.02839*(variables[168]+41.8)/(exp(-(variables[168]+41.8)/2.5)-1.0)-0.0849*(variables[168]+6.8)/(exp(-(variables[168]+6.8)/4.8)-1.0)
variables[169] = -1.80001 if eq_func(variables[140], -1.8) else variables[140]
variables[204] = 0.01143*(variables[169]+1.8)/(exp((variables[169]+1.8)/2.5)-1.0)
variables[210] = 0.001/(variables[203]+variables[204])
rates[29] = (variables[167]-states[29])/variables[210]
variables[163] = 2.0*variables[51]*(variables[140]-0.0)/(variables[117]*(1.0-exp(-1.0*(variables[140]-0.0)*2.0/variables[117])))*(states[30]-variables[35]*exp(-2.0*(variables[140]-0.0)/variables[117]))*states[29]*states[17]*states[5]
variables[172] = 2.0*variables[58]*variables[140]/(variables[117]*(1.0-exp(-1.0*variables[140]*2.0/variables[117])))*(states[30]-variables[35]*exp(-2.0*variables[140]/variables[117]))*states[18]*states[19]
variables[202] = 1.0+variables[35]/variables[76]*(1.0+exp(variables[78]*variables[140]/variables[117]))+variables[38]/variables[68]*(1.0+variables[38]/variables[70]*(1.0+variables[38]/variables[72]))
variables[208] = variables[35]/variables[76]*exp(variables[78]*variables[140]/variables[117])/variables[202]
variables[91] = states[32]
variables[200] = 1.0+states[30]/variables[74]*(1.0+exp(-variables[77]*variables[140]/variables[117])+variables[91]/variables[75])+variables[91]/variables[67]*(1.0+variables[91]/variables[69]*(1.0+variables[91]/variables[71]))
variables[206] = states[30]/variables[74]*exp(-variables[77]*variables[140]/variables[117])/variables[200]
variables[93] = variables[91]/(variables[71]+variables[91])
variables[201] = exp(variables[79]*variables[140]/(2.0*variables[117]))
variables[199] = exp(-variables[79]*variables[140]/(2.0*variables[117]))
variables[207] = variables[91]/variables[67]*variables[91]/variables[69]*(1.0+variables[91]/variables[71])*exp(variables[79]*variables[140]/(2.0*variables[117]))/variables[200]
variables[212] = variables[201]*variables[93]*(variables[207]+variables[206])+variables[199]*variables[206]*(variables[94]+variables[201])
variables[209] = variables[38]/variables[68]*variables[38]/variables[70]*(1.0+variables[38]/variables[72])*exp(-variables[79]*variables[140]/(2.0*variables[117]))/variables[202]
variables[211] = variables[199]*variables[94]*(variables[209]+variables[208])+variables[208]*variables[201]*(variables[93]+variables[199])
variables[214] = variables[209]*variables[94]*(variables[207]+variables[206])+variables[207]*variables[208]*(variables[94]+variables[201])
variables[213] = variables[207]*variables[93]*(variables[209]+variables[208])+variables[206]*variables[209]*(variables[93]+variables[199])
variables[215] = (1.0-variables[80])*variables[73]*(variables[212]*variables[208]-variables[211]*variables[206])/(variables[211]+variables[212]+variables[213]+variables[214])
rates[30] = variables[95]*variables[114]/variables[113]-((variables[163]+variables[172]-2.0*variables[215])/(2.0*variables[40]*variables[113])+variables[103]+variables[9]*variables[110])
variables[137] = variables[117]*log(variables[38]/variables[91])
variables[141] = states[14]*variables[122]*(variables[140]-variables[137])*(1.0-variables[87])
variables[142] = states[14]*variables[123]*(variables[140]-variables[138])*(1.0-variables[87])
variables[143] = variables[141]+variables[142]
variables[158] = variables[64]*states[26]*states[27]*(variables[140]-variables[138])
variables[194] = variables[60]*variables[61]*(variables[140]-variables[138])*(1.0+exp((variables[140]+20.0)/20.0))*states[25] if gt_func(variables[45], 0.0) else 0.0
variables[165] = 0.0000185*variables[51]*(variables[140]-0.0)/(variables[117]*(1.0-exp(-1.0*(variables[140]-0.0)/variables[117])))*(variables[91]-variables[38]*exp(-1.0*(variables[140]-0.0)/variables[117]))*states[29]*states[17]*states[5]
variables[164] = 0.000365*variables[51]*(variables[140]-0.0)/(variables[117]*(1.0-exp(-1.0*(variables[140]-0.0)/variables[117])))*(variables[36]-variables[37]*exp(-1.0*(variables[140]-0.0)/variables[117]))*states[29]*states[17]*states[5]
variables[166] = (variables[163]+variables[164]+variables[165])*(1.0-variables[128])*1.0*variables[127]
variables[126] = variables[117]*log((variables[38]+0.12*variables[37])/(variables[91]+0.12*variables[36]))
variables[146] = variables[65]*pow(states[15], 3.0)*states[16]*(variables[140]-variables[126])
variables[147] = variables[66]*pow(states[15], 3.0)*(variables[140]-variables[126])
variables[148] = variables[146]+variables[147]
variables[198] = variables[92]*variables[83]*pow(1.0+pow(variables[81]/variables[37], 1.2), -1.0)*pow(1.0+pow(variables[82]/variables[91], 1.3), -1.0)*pow(1.0+exp(-(variables[140]-variables[137]+110.0)/20.0), -1.0)
variables[177] = variables[90]*(variables[140]-variables[138])*states[20]*states[21]
variables[134] = variables[117]*log((variables[37]+0.12*variables[38])/(variables[36]+0.12*variables[91]))
variables[190] = variables[133]*(variables[140]-variables[134])*pow(states[28], 2.0)
variables[182] = variables[62]*(variables[140]-variables[138])*(0.9*states[23]+0.1*states[22])*states[24]
variables[216] = variables[143]+variables[182]+variables[190]+variables[177]+variables[198]+variables[215]+variables[148]+variables[166]+variables[172]+variables[194]+variables[158]
rates[31] = -variables[216]/variables[39]
rates[32] = (1.0-variables[44])*-1.0*(variables[148]+variables[141]+variables[165]+3.0*variables[198]+3.0*variables[215])/(1.0*(variables[115]+variables[113])*variables[40])
def compute_variables(voi, states, rates, variables):
variables[91] = states[32]
variables[93] = variables[91]/(variables[71]+variables[91])
variables[95] = variables[8]*states[1]*(states[4]-states[30])
variables[96] = states[4]-states[30]
variables[97] = variables[2]-(variables[2]-variables[3])/(1.0+pow(variables[0]/states[4], variables[1]))
variables[98] = variables[6]/variables[97]
variables[99] = variables[4]*variables[97]
variables[100] = states[0]+states[1]+states[2]+states[3]
variables[103] = (states[30]-states[12])/variables[27]
variables[104] = variables[102]/(1.0+exp((-states[12]+variables[24])/variables[26]))
variables[105] = (states[13]-states[4])/variables[28]
variables[106] = variables[21]*states[12]*(1.0-states[6])-variables[16]*states[6]
variables[107] = variables[22]*states[12]*(1.0-(states[7]+states[8]))-variables[17]*states[7]
variables[108] = variables[23]*variables[11]*(1.0-(states[7]+states[8]))-variables[18]*states[8]
variables[109] = variables[19]*states[12]*(1.0-states[9])-variables[14]*states[9]
variables[110] = variables[19]*states[30]*(1.0-states[10])-variables[14]*states[10]
variables[111] = variables[20]*states[4]*(1.0-states[11])-variables[15]*states[11]
variables[126] = variables[117]*log((variables[38]+0.12*variables[37])/(variables[91]+0.12*variables[36]))
variables[131] = variables[54]/(variables[54]+states[30])
variables[132] = 0.001*variables[131]/variables[55]
variables[134] = variables[117]*log((variables[37]+0.12*variables[38])/(variables[36]+0.12*variables[91]))
variables[137] = variables[117]*log(variables[38]/variables[91])
variables[139] = 0.5*variables[117]*log(variables[35]/states[30])
variables[140] = variables[118] if geq_func(variables[43], 1.0) else states[31]
variables[141] = states[14]*variables[122]*(variables[140]-variables[137])*(1.0-variables[87])
variables[142] = states[14]*variables[123]*(variables[140]-variables[138])*(1.0-variables[87])
variables[143] = variables[141]+variables[142]
variables[144] = 1.0/(0.36*(variables[140]+148.8-variables[124]-variables[125])/(exp(0.066*(variables[140]+148.8-variables[124]-variables[125]))-1.0)+0.1*(variables[140]+87.3-variables[124]-variables[125])/(1.0-exp(-0.2*(variables[140]+87.3-variables[124]-variables[125]))))-0.054
variables[145] = 0.01329+0.99921/(1.0+exp((variables[140]+97.134-variables[124]-variables[125]-variables[89])/8.1752)) if lt_func(variables[140], -(80.0-variables[124]-variables[125]-variables[89])) else 0.0002501*exp(-(variables[140]-variables[124]-variables[125]-variables[89])/12.861)
variables[146] = variables[65]*pow(states[15], 3.0)*states[16]*(variables[140]-variables[126])
variables[147] = variables[66]*pow(states[15], 3.0)*(variables[140]-variables[126])
variables[148] = variables[146]+variables[147]
variables[149] = 1.0/(1.0+exp(-(variables[140]+42.0504)/8.3106))
variables[150] = variables[140]+41.0
variables[151] = 2000.0 if lt_func(fabs(variables[150]), variables[84]) else 200.0*variables[150]/(1.0-exp(-0.1*variables[150]))
variables[152] = 8000.0*exp(-0.056*(variables[140]+66.0))
variables[153] = 1.0/(variables[151]+variables[152])
variables[154] = 1.0/(1.0+exp((variables[140]+69.804)/4.4565))
variables[155] = 20.0*exp(-0.125*(variables[140]+75.0))
variables[156] = 2000.0/(320.0*exp(-0.1*(variables[140]+75.0))+1.0)
variables[157] = 1.0/(variables[155]+variables[156])
variables[158] = variables[64]*states[26]*states[27]*(variables[140]-variables[138])
variables[159] = 1.0/(1.0+exp((variables[140]+6.0)/-8.6))
variables[160] = 0.009/(1.0+exp((variables[140]+5.0)/12.0))+0.0005
variables[161] = 1.0/(1.0+exp((variables[140]+7.5)/10.0))
variables[162] = 0.59/(1.0+exp((variables[140]+60.0)/10.0))+3.05
variables[163] = 2.0*variables[51]*(variables[140]-0.0)/(variables[117]*(1.0-exp(-1.0*(variables[140]-0.0)*2.0/variables[117])))*(states[30]-variables[35]*exp(-2.0*(variables[140]-0.0)/variables[117]))*states[29]*states[17]*states[5]
variables[164] = 0.000365*variables[51]*(variables[140]-0.0)/(variables[117]*(1.0-exp(-1.0*(variables[140]-0.0)/variables[117])))*(variables[36]-variables[37]*exp(-1.0*(variables[140]-0.0)/variables[117]))*states[29]*states[17]*states[5]
variables[165] = 0.0000185*variables[51]*(variables[140]-0.0)/(variables[117]*(1.0-exp(-1.0*(variables[140]-0.0)/variables[117])))*(variables[91]-variables[38]*exp(-1.0*(variables[140]-0.0)/variables[117]))*states[29]*states[17]*states[5]
variables[166] = (variables[163]+variables[164]+variables[165])*(1.0-variables[128])*1.0*variables[127]
variables[167] = 1.0/(1.0+exp(-(variables[140]-variables[52]-variables[129])/(variables[53]*(1.0+variables[130]/100.0))))
variables[168] = -41.80001 if eq_func(variables[140], -41.8) else 0.0 if eq_func(variables[140], 0.0) else -6.80001 if eq_func(variables[140], -6.8) else variables[140]
variables[169] = -1.80001 if eq_func(variables[140], -1.8) else variables[140]
variables[170] = 1.0/(1.0+exp((variables[140]+37.4+variables[57])/(5.3+variables[56])))
variables[171] = 0.001*(44.3+230.0*exp(-pow((variables[140]+36.0)/10.0, 2.0)))
variables[172] = 2.0*variables[58]*variables[140]/(variables[117]*(1.0-exp(-1.0*variables[140]*2.0/variables[117])))*(states[30]-variables[35]*exp(-2.0*variables[140]/variables[117]))*states[18]*states[19]
variables[173] = 1.0/(1.0+exp(-(variables[140]+38.3)/5.5))
variables[174] = 0.001/(1.068*exp((variables[140]+38.3)/30.0)+1.068*exp(-(variables[140]+38.3)/30.0))
variables[175] = 1.0/(1.0+exp((variables[140]+58.7)/3.8))
variables[176] = 1.0/(16.67*exp(-(variables[140]+75.0)/83.3)+16.67*exp((variables[140]+75.0)/15.38))+variables[59]
variables[177] = variables[90]*(variables[140]-variables[138])*states[20]*states[21]
variables[178] = 1.0/(1.0+exp((variables[140]+49.0)/13.0))
variables[179] = 0.001*0.6*(65.17/(0.57*exp(-0.08*(variables[140]+44.0))+0.065*exp(0.1*(variables[140]+45.93)))+10.1)
variables[180] = 1.0/(1.0+exp(-(variables[140]-19.3)/15.0))
variables[181] = 0.001*0.66*1.4*(15.59/(1.037*exp(0.09*(variables[140]+30.61))+0.369*exp(-0.12*(variables[140]+23.84)))+2.98)
variables[182] = variables[62]*(variables[140]-variables[138])*(0.9*states[23]+0.1*states[22])*states[24]
variables[183] = 1.0/(1.0+exp(-(variables[140]+23.2)/6.6))/(0.84655354/(37.2*exp(variables[140]/11.9)+0.96*exp(-variables[140]/18.5)))
variables[184] = 4.0*((37.2*exp(variables[140]/15.9)+0.96*exp(-variables[140]/22.5))/0.84655354-1.0/(1.0+exp(-(variables[140]+23.2)/10.6))/(0.84655354/(37.2*exp(variables[140]/15.9)+0.96*exp(-variables[140]/22.5))))
variables[185] = 1.0/(1.0+exp(-(variables[140]+10.0144)/7.6607))
variables[186] = 0.84655354/(4.2*exp(variables[140]/17.0)+0.15*exp(-variables[140]/21.6))
variables[187] = 1.0/(30.0*exp(variables[140]/10.0)+exp(-variables[140]/12.0))
variables[188] = 1.0/(100.0*exp(-variables[140]/54.645)+656.0*exp(variables[140]/106.157))
variables[189] = 1.0/(1.0+exp((variables[140]+28.6)/17.1))
variables[190] = variables[133]*(variables[140]-variables[134])*pow(states[28], 2.0)
variables[191] = sqrt(1.0/(1.0+exp(-(variables[140]+0.6383-variables[135])/10.7071)))
variables[192] = 28.0/(1.0+exp(-(variables[140]-40.0-variables[135])/3.0))
variables[193] = 1.0*exp(-(variables[140]-variables[135]-5.0)/25.0)
variables[194] = variables[60]*variables[61]*(variables[140]-variables[138])*(1.0+exp((variables[140]+20.0)/20.0))*states[25] if gt_func(variables[45], 0.0) else 0.0
variables[195] = 10.0*exp(0.0133*(variables[140]+40.0))
variables[196] = variables[136]/(variables[136]+variables[195])
variables[197] = 1.0/(variables[136]+variables[195])
variables[198] = variables[92]*variables[83]*pow(1.0+pow(variables[81]/variables[37], 1.2), -1.0)*pow(1.0+pow(variables[82]/variables[91], 1.3), -1.0)*pow(1.0+exp(-(variables[140]-variables[137]+110.0)/20.0), -1.0)
variables[199] = exp(-variables[79]*variables[140]/(2.0*variables[117]))
variables[200] = 1.0+states[30]/variables[74]*(1.0+exp(-variables[77]*variables[140]/variables[117])+variables[91]/variables[75])+variables[91]/variables[67]*(1.0+variables[91]/variables[69]*(1.0+variables[91]/variables[71]))
variables[201] = exp(variables[79]*variables[140]/(2.0*variables[117]))
variables[202] = 1.0+variables[35]/variables[76]*(1.0+exp(variables[78]*variables[140]/variables[117]))+variables[38]/variables[68]*(1.0+variables[38]/variables[70]*(1.0+variables[38]/variables[72]))
variables[203] = -0.02839*(variables[168]+41.8)/(exp(-(variables[168]+41.8)/2.5)-1.0)-0.0849*(variables[168]+6.8)/(exp(-(variables[168]+6.8)/4.8)-1.0)
variables[204] = 0.01143*(variables[169]+1.8)/(exp((variables[169]+1.8)/2.5)-1.0)
variables[205] = 1.0/(variables[192]+variables[193])
variables[206] = states[30]/variables[74]*exp(-variables[77]*variables[140]/variables[117])/variables[200]
variables[207] = variables[91]/variables[67]*variables[91]/variables[69]*(1.0+variables[91]/variables[71])*exp(variables[79]*variables[140]/(2.0*variables[117]))/variables[200]
variables[208] = variables[35]/variables[76]*exp(variables[78]*variables[140]/variables[117])/variables[202]
variables[209] = variables[38]/variables[68]*variables[38]/variables[70]*(1.0+variables[38]/variables[72])*exp(-variables[79]*variables[140]/(2.0*variables[117]))/variables[202]
variables[210] = 0.001/(variables[203]+variables[204])
variables[211] = variables[199]*variables[94]*(variables[209]+variables[208])+variables[208]*variables[201]*(variables[93]+variables[199])
variables[212] = variables[201]*variables[93]*(variables[207]+variables[206])+variables[199]*variables[206]*(variables[94]+variables[201])
variables[213] = variables[207]*variables[93]*(variables[209]+variables[208])+variables[206]*variables[209]*(variables[93]+variables[199])
variables[214] = variables[209]*variables[94]*(variables[207]+variables[206])+variables[207]*variables[208]*(variables[94]+variables[201])
variables[215] = (1.0-variables[80])*variables[73]*(variables[212]*variables[208]-variables[211]*variables[206])/(variables[211]+variables[212]+variables[213]+variables[214])
variables[216] = variables[143]+variables[182]+variables[190]+variables[177]+variables[198]+variables[215]+variables[148]+variables[166]+variables[172]+variables[194]+variables[158]
| 79.128058
| 291
| 0.658399
| 7,660
| 54,994
| 4.626632
| 0.077285
| 0.097968
| 0.071247
| 0.081828
| 0.846191
| 0.816535
| 0.783042
| 0.729007
| 0.709086
| 0.582816
| 0
| 0.121786
| 0.108321
| 54,994
| 694
| 292
| 79.242075
| 0.600934
| 0.001509
| 0
| 0.287443
| 1
| 0
| 0.220838
| 0.011401
| 0
| 0
| 0
| 0
| 0
| 1
| 0.016641
| false
| 0
| 0.003026
| 0.01059
| 0.036309
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
68ada9f559b6880610e7c925d951ea009ddd6104
| 103
|
py
|
Python
|
tests/fixtures/compound_statements/compound_statements3_out.py
|
spulec/pep8ify
|
cf1815f7bad9882027289bdb2f77604b68962ca7
|
[
"Apache-2.0"
] | 50
|
2015-01-04T04:24:41.000Z
|
2021-09-13T01:01:29.000Z
|
tests/fixtures/compound_statements/compound_statements3_out.py
|
michaelBenin/pep8ify
|
3cd8a9e8baaab33d66e792185a6870338bdf0911
|
[
"Apache-2.0"
] | 2
|
2016-05-15T12:01:28.000Z
|
2019-03-08T03:27:20.000Z
|
tests/fixtures/compound_statements/compound_statements3_out.py
|
michaelBenin/pep8ify
|
3cd8a9e8baaab33d66e792185a6870338bdf0911
|
[
"Apache-2.0"
] | 5
|
2016-07-27T13:44:54.000Z
|
2020-11-19T16:00:08.000Z
|
do_it()
def x():
do_it()
dont_do_it()
def y():
do_it()
# comment
dont_do_it()
| 7.357143
| 16
| 0.485437
| 17
| 103
| 2.529412
| 0.411765
| 0.465116
| 0.325581
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.349515
| 103
| 13
| 17
| 7.923077
| 0.641791
| 0.067961
| 0
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| true
| 0
| 0
| 0
| 0.285714
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
d79a5447e678fcfdca9db5ad742718da254c7a03
| 49
|
py
|
Python
|
Python/libraries/recognizers-number/recognizers_number/number/portuguese/__init__.py
|
hongman/Recognizers-Text
|
f5c158b9f60a86574633d7d67c47965dcab90abd
|
[
"MIT"
] | 10
|
2019-05-11T18:07:14.000Z
|
2021-08-20T03:02:47.000Z
|
Python/libraries/recognizers-number/recognizers_number/number/portuguese/__init__.py
|
hongman/Recognizers-Text
|
f5c158b9f60a86574633d7d67c47965dcab90abd
|
[
"MIT"
] | 76
|
2018-11-09T18:19:44.000Z
|
2019-08-20T20:29:53.000Z
|
Python/libraries/recognizers-number/recognizers_number/number/portuguese/__init__.py
|
hongman/Recognizers-Text
|
f5c158b9f60a86574633d7d67c47965dcab90abd
|
[
"MIT"
] | 18
|
2019-08-19T12:11:00.000Z
|
2021-10-12T09:36:27.000Z
|
from .extractors import *
from .parsers import *
| 16.333333
| 25
| 0.755102
| 6
| 49
| 6.166667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.163265
| 49
| 2
| 26
| 24.5
| 0.902439
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
d7e90c81e1d7213261d68edfd5007ba523aa9890
| 22
|
py
|
Python
|
proj/__init__.py
|
LibAestheticism/djcelery-demo
|
f92b1ac697e23206bbcc2b2431a2ee553e6256cd
|
[
"Apache-2.0"
] | 5
|
2019-01-23T07:31:52.000Z
|
2021-09-23T10:03:21.000Z
|
proj/__init__.py
|
LibAestheticism/djcelery-demo
|
f92b1ac697e23206bbcc2b2431a2ee553e6256cd
|
[
"Apache-2.0"
] | null | null | null |
proj/__init__.py
|
LibAestheticism/djcelery-demo
|
f92b1ac697e23206bbcc2b2431a2ee553e6256cd
|
[
"Apache-2.0"
] | 1
|
2020-11-18T06:32:45.000Z
|
2020-11-18T06:32:45.000Z
|
from .celery import *
| 11
| 21
| 0.727273
| 3
| 22
| 5.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 22
| 1
| 22
| 22
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
0be1e38b59b5b1714ceec69bafe9c2a123426c85
| 114
|
py
|
Python
|
deeprank/rank_module/__init__.py
|
pl8787/DeepRank_PyTorch
|
ec24f83168aeadad7f89fd9fae5992abd0da89b1
|
[
"MIT"
] | 31
|
2019-07-03T15:26:02.000Z
|
2022-03-06T14:38:25.000Z
|
deeprank/rank_module/__init__.py
|
pl8787/DeepRank_PyTorch
|
ec24f83168aeadad7f89fd9fae5992abd0da89b1
|
[
"MIT"
] | 1
|
2020-08-13T21:56:15.000Z
|
2021-08-10T02:52:52.000Z
|
deeprank/rank_module/__init__.py
|
pl8787/DeepRank_PyTorch
|
ec24f83168aeadad7f89fd9fae5992abd0da89b1
|
[
"MIT"
] | 8
|
2019-09-03T01:28:54.000Z
|
2020-10-30T14:36:37.000Z
|
from .rank_net import RankNet
from .matchpyramid_net import MatchPyramidNet
from .deeprank_net import DeepRankNet
| 28.5
| 45
| 0.868421
| 15
| 114
| 6.4
| 0.6
| 0.28125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 114
| 3
| 46
| 38
| 0.941176
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
0beee745e6c92ed99d1b5170ccaf5413eabac436
| 76
|
py
|
Python
|
decavision/model_training/__init__.py
|
Decathlon/decavision
|
b79d2b5611025a5f8519b9154acf04844ef8fb91
|
[
"MIT"
] | 3
|
2020-12-08T19:14:46.000Z
|
2021-03-30T15:12:44.000Z
|
decavision/model_training/__init__.py
|
Decathlon/decavision
|
b79d2b5611025a5f8519b9154acf04844ef8fb91
|
[
"MIT"
] | 13
|
2021-03-30T15:12:49.000Z
|
2022-03-12T00:51:57.000Z
|
decavision/model_training/__init__.py
|
Decathlon/decavision
|
b79d2b5611025a5f8519b9154acf04844ef8fb91
|
[
"MIT"
] | 1
|
2021-03-30T15:20:56.000Z
|
2021-03-30T15:20:56.000Z
|
from . import progressive_learning
from . import tfrecords_image_classifier
| 25.333333
| 40
| 0.868421
| 9
| 76
| 7
| 0.777778
| 0.31746
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 76
| 2
| 41
| 38
| 0.926471
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
04008d58db2304654002d4639143d1cadbcf6132
| 37
|
py
|
Python
|
riposte/__init__.py
|
macdaliot/riposte
|
4f51528e31636586c36218ed0993ba1f4b4a8ab8
|
[
"MIT"
] | 481
|
2018-11-20T10:35:10.000Z
|
2022-03-26T20:33:54.000Z
|
riposte/__init__.py
|
macdaliot/riposte
|
4f51528e31636586c36218ed0993ba1f4b4a8ab8
|
[
"MIT"
] | 11
|
2019-07-03T21:01:46.000Z
|
2021-05-22T10:00:49.000Z
|
riposte/__init__.py
|
macdaliot/riposte
|
4f51528e31636586c36218ed0993ba1f4b4a8ab8
|
[
"MIT"
] | 53
|
2019-07-08T07:53:16.000Z
|
2022-01-09T03:32:57.000Z
|
from .riposte import Riposte # noqa
| 18.5
| 36
| 0.756757
| 5
| 37
| 5.6
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.189189
| 37
| 1
| 37
| 37
| 0.933333
| 0.108108
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 6
|
042e058bea286191e4d3200701c251c03174fa56
| 6,538
|
py
|
Python
|
test/vanilla/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/queries_operations.py
|
iscai-msft/autorest.python
|
a9f38dd762fbc046ce6197bfabea2f56045d2957
|
[
"MIT"
] | null | null | null |
test/vanilla/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/queries_operations.py
|
iscai-msft/autorest.python
|
a9f38dd762fbc046ce6197bfabea2f56045d2957
|
[
"MIT"
] | null | null | null |
test/vanilla/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/queries_operations.py
|
iscai-msft/autorest.python
|
a9f38dd762fbc046ce6197bfabea2f56045d2957
|
[
"MIT"
] | null | null | null |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.pipeline import ClientRawResponse
from .. import models
class QueriesOperations(object):
"""QueriesOperations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.config = config
def array_string_multi_null(
self, array_query=None, custom_headers=None, raw=False, **operation_config):
"""Get a null array of string using the multi-array format.
:param array_query: a null array of string using the multi-array
format
:type array_query: list[str]
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorException<urlmulticollectionformat.models.ErrorException>`
"""
# Construct URL
url = self.array_string_multi_null.metadata['url']
# Construct parameters
query_parameters = {}
if array_query is not None:
query_parameters['arrayQuery'] = self._serialize.query("array_query", array_query, '[str]', div=',')
# Construct headers
header_parameters = {}
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
array_string_multi_null.metadata = {'url': '/queries/array/multi/string/null'}
def array_string_multi_empty(
self, array_query=None, custom_headers=None, raw=False, **operation_config):
"""Get an empty array [] of string using the multi-array format.
:param array_query: an empty array [] of string using the multi-array
format
:type array_query: list[str]
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorException<urlmulticollectionformat.models.ErrorException>`
"""
# Construct URL
url = self.array_string_multi_empty.metadata['url']
# Construct parameters
query_parameters = {}
if array_query is not None:
query_parameters['arrayQuery'] = self._serialize.query("array_query", array_query, '[str]', div=',')
# Construct headers
header_parameters = {}
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
array_string_multi_empty.metadata = {'url': '/queries/array/multi/string/empty'}
def array_string_multi_valid(
self, array_query=None, custom_headers=None, raw=False, **operation_config):
"""Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' ,
null, ''] using the mult-array format.
:param array_query: an array of string ['ArrayQuery1', 'begin!*'();:@
&=+$,/?#[]end' , null, ''] using the mult-array format
:type array_query: list[str]
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorException<urlmulticollectionformat.models.ErrorException>`
"""
# Construct URL
url = self.array_string_multi_valid.metadata['url']
# Construct parameters
query_parameters = {}
if array_query is not None:
query_parameters['arrayQuery'] = self._serialize.query("array_query", array_query, '[str]', div=',')
# Construct headers
header_parameters = {}
if custom_headers:
header_parameters.update(custom_headers)
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
array_string_multi_valid.metadata = {'url': '/queries/array/multi/string/valid'}
| 40.358025
| 112
| 0.654329
| 705
| 6,538
| 5.900709
| 0.178723
| 0.043269
| 0.034615
| 0.017308
| 0.823077
| 0.823077
| 0.788221
| 0.788221
| 0.788221
| 0.788221
| 0
| 0.002402
| 0.235852
| 6,538
| 161
| 113
| 40.608696
| 0.830264
| 0.427807
| 0
| 0.7
| 0
| 0
| 0.058718
| 0.02921
| 0
| 0
| 0
| 0
| 0
| 1
| 0.066667
| false
| 0
| 0.033333
| 0
| 0.183333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
f0f371f6b7ddfaea5ec44b3a7a40c78808cc5783
| 19,423
|
py
|
Python
|
model_utils.py
|
BoyuanChen/neural-state-variables
|
10483d93ac8c006f3786c434fb57d70d9ab465ec
|
[
"MIT"
] | 17
|
2021-12-29T16:48:46.000Z
|
2022-03-25T01:57:13.000Z
|
model_utils.py
|
BoyuanChen/neural-state-variables
|
10483d93ac8c006f3786c434fb57d70d9ab465ec
|
[
"MIT"
] | null | null | null |
model_utils.py
|
BoyuanChen/neural-state-variables
|
10483d93ac8c006f3786c434fb57d70d9ab465ec
|
[
"MIT"
] | 1
|
2022-01-22T11:26:09.000Z
|
2022-01-22T11:26:09.000Z
|
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def conv2d_bn_relu(inch,outch,kernel_size,stride=1,padding=1):
convlayer = torch.nn.Sequential(
torch.nn.Conv2d(inch,outch,kernel_size=kernel_size,stride=stride,padding=padding),
torch.nn.BatchNorm2d(outch),
torch.nn.ReLU()
)
return convlayer
def conv2d_bn_sigmoid(inch,outch,kernel_size,stride=1,padding=1):
convlayer = torch.nn.Sequential(
torch.nn.Conv2d(inch,outch,kernel_size=kernel_size,stride=stride,padding=padding),
torch.nn.BatchNorm2d(outch),
torch.nn.Sigmoid()
)
return convlayer
def deconv_sigmoid(inch,outch,kernel_size,stride=1,padding=1):
convlayer = torch.nn.Sequential(
torch.nn.ConvTranspose2d(inch,outch,kernel_size=kernel_size,stride=stride,padding=padding),
torch.nn.Sigmoid()
)
return convlayer
def deconv_relu(inch,outch,kernel_size,stride=1,padding=1):
convlayer = torch.nn.Sequential(
torch.nn.ConvTranspose2d(inch,outch,kernel_size=kernel_size,stride=stride,padding=padding),
torch.nn.BatchNorm2d(outch),
torch.nn.ReLU()
)
return convlayer
class EncoderDecoder(torch.nn.Module):
def __init__(self, in_channels):
super(EncoderDecoder,self).__init__()
self.conv_stack1 = torch.nn.Sequential(
conv2d_bn_relu(in_channels,32,4,stride=2),
conv2d_bn_relu(32,32,3)
)
self.conv_stack2 = torch.nn.Sequential(
conv2d_bn_relu(32,32,4,stride=2),
conv2d_bn_relu(32,32,3)
)
self.conv_stack3 = torch.nn.Sequential(
conv2d_bn_relu(32,64,4,stride=2),
conv2d_bn_relu(64,64,3)
)
self.conv_stack4 = torch.nn.Sequential(
conv2d_bn_relu(64,128,4,stride=2),
conv2d_bn_relu(128,128,3),
)
self.conv_stack5 = torch.nn.Sequential(
conv2d_bn_relu(128,128,(3,4),stride=(1,2)),
conv2d_bn_relu(128,128,3),
)
self.deconv_5 = deconv_relu(128,64,(3,4),stride=(1,2))
self.deconv_4 = deconv_relu(67,64,4,stride=2)
self.deconv_3 = deconv_relu(67,32,4,stride=2)
self.deconv_2 = deconv_relu(35,16,4,stride=2)
self.deconv_1 = deconv_sigmoid(19,3,4,stride=2)
self.predict_5 = torch.nn.Conv2d(128,3,3,stride=1,padding=1)
self.predict_4 = torch.nn.Conv2d(67,3,3,stride=1,padding=1)
self.predict_3 = torch.nn.Conv2d(67,3,3,stride=1,padding=1)
self.predict_2 = torch.nn.Conv2d(35,3,3,stride=1,padding=1)
self.up_sample_5 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,(3,4),stride=(1,2),padding=1,bias=False),
torch.nn.Sigmoid()
)
self.up_sample_4 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,4,stride=2,padding=1,bias=False),
torch.nn.Sigmoid()
)
self.up_sample_3 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,4,stride=2,padding=1,bias=False),
torch.nn.Sigmoid()
)
self.up_sample_2 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,4,stride=2,padding=1,bias=False),
torch.nn.Sigmoid()
)
def encoder(self, x):
conv1_out = self.conv_stack1(x)
conv2_out = self.conv_stack2(conv1_out)
conv3_out = self.conv_stack3(conv2_out)
conv4_out = self.conv_stack4(conv3_out)
conv5_out = self.conv_stack5(conv4_out)
return conv5_out
def decoder(self, x):
deconv5_out = self.deconv_5(x)
predict_5_out = self.up_sample_5(self.predict_5(x))
concat_5 = torch.cat([deconv5_out, predict_5_out],dim=1)
deconv4_out = self.deconv_4(concat_5)
predict_4_out = self.up_sample_4(self.predict_4(concat_5))
concat_4 = torch.cat([deconv4_out,predict_4_out],dim=1)
deconv3_out = self.deconv_3(concat_4)
predict_3_out = self.up_sample_3(self.predict_3(concat_4))
concat2 = torch.cat([deconv3_out,predict_3_out],dim=1)
deconv2_out = self.deconv_2(concat2)
predict_2_out = self.up_sample_2(self.predict_2(concat2))
concat1 = torch.cat([deconv2_out,predict_2_out],dim=1)
predict_out = self.deconv_1(concat1)
return predict_out
def forward(self,x):
latent = self.encoder(x)
out = self.decoder(latent)
return out, latent
class EncoderDecoder64x1x1(torch.nn.Module):
def __init__(self, in_channels):
super(EncoderDecoder64x1x1,self).__init__()
self.conv_stack1 = torch.nn.Sequential(
conv2d_bn_relu(in_channels,32,4,stride=2),
conv2d_bn_relu(32,32,3)
)
self.conv_stack2 = torch.nn.Sequential(
conv2d_bn_relu(32,32,4,stride=2),
conv2d_bn_relu(32,32,3)
)
self.conv_stack3 = torch.nn.Sequential(
conv2d_bn_relu(32,64,4,stride=2),
conv2d_bn_relu(64,64,3)
)
self.conv_stack4 = torch.nn.Sequential(
conv2d_bn_relu(64,64,4,stride=2),
conv2d_bn_relu(64,64,3),
)
self.conv_stack5 = torch.nn.Sequential(
conv2d_bn_relu(64,64,4,stride=2),
conv2d_bn_relu(64,64,3),
)
self.conv_stack6 = torch.nn.Sequential(
conv2d_bn_relu(64,64,4,stride=2),
conv2d_bn_relu(64,64,3),
)
self.conv_stack7 = torch.nn.Sequential(
conv2d_bn_relu(64,64,4,stride=2),
conv2d_bn_relu(64,64,3),
)
self.conv_stack8 = torch.nn.Sequential(
conv2d_bn_relu(64, 64, (3,4), stride=(1,2)),
conv2d_bn_relu(64, 64, 3),
)
self.deconv_8 = deconv_relu(64,64,(3,4),stride=(1,2))
self.deconv_7 = deconv_relu(67,64,4,stride=2)
self.deconv_6 = deconv_relu(67,64,4,stride=2)
self.deconv_5 = deconv_relu(67,64,4,stride=2)
self.deconv_4 = deconv_relu(67,64,4,stride=2)
self.deconv_3 = deconv_relu(67,32,4,stride=2)
self.deconv_2 = deconv_relu(35,16,4,stride=2)
self.deconv_1 = deconv_sigmoid(19,3,4,stride=2)
self.predict_8 = torch.nn.Conv2d(64,3,3,stride=1,padding=1)
self.predict_7 = torch.nn.Conv2d(67,3,3,stride=1,padding=1)
self.predict_6 = torch.nn.Conv2d(67,3,3,stride=1,padding=1)
self.predict_5 = torch.nn.Conv2d(67,3,3,stride=1,padding=1)
self.predict_4 = torch.nn.Conv2d(67,3,3,stride=1,padding=1)
self.predict_3 = torch.nn.Conv2d(67,3,3,stride=1,padding=1)
self.predict_2 = torch.nn.Conv2d(35,3,3,stride=1,padding=1)
self.up_sample_8 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,(3,4),stride=(1,2),padding=1,bias=False),
torch.nn.Sigmoid()
)
self.up_sample_7 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,4,stride=2,padding=1,bias=False),
torch.nn.Sigmoid()
)
self.up_sample_6 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,4,stride=2,padding=1,bias=False),
torch.nn.Sigmoid()
)
self.up_sample_5 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,4,stride=2,padding=1,bias=False),
torch.nn.Sigmoid()
)
self.up_sample_4 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,4,stride=2,padding=1,bias=False),
torch.nn.Sigmoid()
)
self.up_sample_3 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,4,stride=2,padding=1,bias=False),
torch.nn.Sigmoid()
)
self.up_sample_2 = torch.nn.Sequential(
torch.nn.ConvTranspose2d(3,3,4,stride=2,padding=1,bias=False),
torch.nn.Sigmoid()
)
def encoder(self, x):
conv1_out = self.conv_stack1(x)
conv2_out = self.conv_stack2(conv1_out)
conv3_out = self.conv_stack3(conv2_out)
conv4_out = self.conv_stack4(conv3_out)
conv5_out = self.conv_stack5(conv4_out)
conv6_out = self.conv_stack6(conv5_out)
conv7_out = self.conv_stack7(conv6_out)
conv8_out = self.conv_stack8(conv7_out)
return conv8_out
def decoder(self, x):
deconv8_out = self.deconv_8(x)
predict_8_out = self.up_sample_8(self.predict_8(x))
concat_7 = torch.cat([deconv8_out, predict_8_out], dim=1)
deconv7_out = self.deconv_7(concat_7)
predict_7_out = self.up_sample_7(self.predict_7(concat_7))
concat_6 = torch.cat([deconv7_out,predict_7_out],dim=1)
deconv6_out = self.deconv_6(concat_6)
predict_6_out = self.up_sample_6(self.predict_6(concat_6))
concat_5 = torch.cat([deconv6_out,predict_6_out],dim=1)
deconv5_out = self.deconv_5(concat_5)
predict_5_out = self.up_sample_5(self.predict_5(concat_5))
concat_4 = torch.cat([deconv5_out,predict_5_out],dim=1)
deconv4_out = self.deconv_4(concat_4)
predict_4_out = self.up_sample_4(self.predict_4(concat_4))
concat_3 = torch.cat([deconv4_out,predict_4_out],dim=1)
deconv3_out = self.deconv_3(concat_3)
predict_3_out = self.up_sample_3(self.predict_3(concat_3))
concat2 = torch.cat([deconv3_out,predict_3_out],dim=1)
deconv2_out = self.deconv_2(concat2)
predict_2_out = self.up_sample_2(self.predict_2(concat2))
concat1 = torch.cat([deconv2_out,predict_2_out],dim=1)
predict_out = self.deconv_1(concat1)
return predict_out
def forward(self,x, reconstructed_latent, refine_latent):
if refine_latent != True:
latent = self.encoder(x)
out = self.decoder(latent)
return out, latent
else:
latent = self.encoder(x)
out = self.decoder(reconstructed_latent)
return out, latent
class SirenLayer(nn.Module):
def __init__(self, in_f, out_f, w0=30, is_first=False, is_last=False):
super().__init__()
self.in_f = in_f
self.w0 = w0
self.linear = nn.Linear(in_f, out_f)
self.is_first = is_first
self.is_last = is_last
self.init_weights()
def init_weights(self):
b = 1 / self.in_f if self.is_first else np.sqrt(6 / self.in_f) / self.w0
with torch.no_grad():
self.linear.weight.uniform_(-b, b)
def forward(self, x):
x = self.linear(x)
return x if self.is_last else torch.sin(self.w0 * x)
class RefineDoublePendulumModel(torch.nn.Module):
def __init__(self, in_channels):
super(RefineDoublePendulumModel, self).__init__()
self.layer1 = SirenLayer(in_channels, 128, is_first=True)
self.layer2 = SirenLayer(128, 64)
self.layer3 = SirenLayer(64, 32)
self.layer4 = SirenLayer(32, 4)
self.layer5 = SirenLayer(4, 32)
self.layer6 = SirenLayer(32, 64)
self.layer7 = SirenLayer(64, 128)
self.layer8 = SirenLayer(128, in_channels, is_last=True)
def forward(self, x):
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
latent = self.layer4(x)
x = self.layer5(latent)
x = self.layer6(x)
x = self.layer7(x)
x = self.layer8(x)
return x, latent
class RefineElasticPendulumModel(torch.nn.Module):
def __init__(self, in_channels):
super(RefineElasticPendulumModel, self).__init__()
self.layer1 = SirenLayer(in_channels, 128, is_first=True)
self.layer2 = SirenLayer(128, 64)
self.layer3 = SirenLayer(64, 32)
self.layer4 = SirenLayer(32, 6)
self.layer5 = SirenLayer(6, 32)
self.layer6 = SirenLayer(32, 64)
self.layer7 = SirenLayer(64, 128)
self.layer8 = SirenLayer(128, in_channels, is_last=True)
def forward(self, x):
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
latent = self.layer4(x)
x = self.layer5(latent)
x = self.layer6(x)
x = self.layer7(x)
x = self.layer8(x)
return x, latent
class RefineReactionDiffusionModel(torch.nn.Module):
def __init__(self, in_channels):
super(RefineReactionDiffusionModel, self).__init__()
self.layer1 = SirenLayer(in_channels, 128, is_first=True)
self.layer2 = SirenLayer(128, 64)
self.layer3 = SirenLayer(64, 32)
self.layer4 = SirenLayer(32, 2)
self.layer5 = SirenLayer(2, 32)
self.layer6 = SirenLayer(32, 64)
self.layer7 = SirenLayer(64, 128)
self.layer8 = SirenLayer(128, in_channels, is_last=True)
def forward(self, x):
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
latent = self.layer4(x)
x = self.layer5(latent)
x = self.layer6(x)
x = self.layer7(x)
x = self.layer8(x)
return x, latent
class RefineSwingStickNonMagneticModel(torch.nn.Module):
def __init__(self, in_channels):
super(RefineSwingStickNonMagneticModel, self).__init__()
self.layer1 = SirenLayer(in_channels, 128, is_first=True)
self.layer2 = SirenLayer(128, 64)
self.layer3 = SirenLayer(64, 32)
self.layer4 = SirenLayer(32, 4)
self.layer5 = SirenLayer(4, 32)
self.layer6 = SirenLayer(32, 64)
self.layer7 = SirenLayer(64, 128)
self.layer8 = SirenLayer(128, in_channels, is_last=True)
def forward(self, x):
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
latent = self.layer4(x)
x = self.layer5(latent)
x = self.layer6(x)
x = self.layer7(x)
x = self.layer8(x)
return x, latent
class RefineSinglePendulumModel(torch.nn.Module):
def __init__(self, in_channels):
super(RefineSinglePendulumModel, self).__init__()
self.layer1 = SirenLayer(in_channels, 128, is_first=True)
self.layer2 = SirenLayer(128, 64)
self.layer3 = SirenLayer(64, 32)
self.layer4 = SirenLayer(32, 2)
self.layer5 = SirenLayer(2, 32)
self.layer6 = SirenLayer(32, 64)
self.layer7 = SirenLayer(64, 128)
self.layer8 = SirenLayer(128, in_channels, is_last=True)
def forward(self, x):
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
latent = self.layer4(x)
x = self.layer5(latent)
x = self.layer6(x)
x = self.layer7(x)
x = self.layer8(x)
return x, latent
class RefineCircularMotionModel(torch.nn.Module):
def __init__(self, in_channels):
super(RefineCircularMotionModel, self).__init__()
self.layer1 = SirenLayer(in_channels, 128, is_first=True)
self.layer2 = SirenLayer(128, 64)
self.layer3 = SirenLayer(64, 32)
self.layer4 = SirenLayer(32, 2)
self.layer5 = SirenLayer(2, 32)
self.layer6 = SirenLayer(32, 64)
self.layer7 = SirenLayer(64, 128)
self.layer8 = SirenLayer(128, in_channels, is_last=True)
def forward(self, x):
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
latent = self.layer4(x)
x = self.layer5(latent)
x = self.layer6(x)
x = self.layer7(x)
x = self.layer8(x)
return x, latent
class RefineAirDancerModel(torch.nn.Module):
def __init__(self, in_channels):
super(RefineAirDancerModel, self).__init__()
self.layer1 = SirenLayer(in_channels, 128, is_first=True)
self.layer2 = SirenLayer(128, 64)
self.layer3 = SirenLayer(64, 32)
self.layer4 = SirenLayer(32, 8)
self.layer5 = SirenLayer(8, 32)
self.layer6 = SirenLayer(32, 64)
self.layer7 = SirenLayer(64, 128)
self.layer8 = SirenLayer(128, in_channels, is_last=True)
def forward(self, x):
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
latent = self.layer4(x)
x = self.layer5(latent)
x = self.layer6(x)
x = self.layer7(x)
x = self.layer8(x)
return x, latent
class RefineLavaLampModel(torch.nn.Module):
def __init__(self, in_channels):
super(RefineLavaLampModel, self).__init__()
self.layer1 = SirenLayer(in_channels, 128, is_first=True)
self.layer2 = SirenLayer(128, 64)
self.layer3 = SirenLayer(64, 32)
self.layer4 = SirenLayer(32, 8)
self.layer5 = SirenLayer(8, 32)
self.layer6 = SirenLayer(32, 64)
self.layer7 = SirenLayer(64, 128)
self.layer8 = SirenLayer(128, in_channels, is_last=True)
def forward(self, x):
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
latent = self.layer4(x)
x = self.layer5(latent)
x = self.layer6(x)
x = self.layer7(x)
x = self.layer8(x)
return x, latent
class RefineFireModel(torch.nn.Module):
def __init__(self, in_channels):
super(RefineFireModel, self).__init__()
self.layer1 = SirenLayer(in_channels, 128, is_first=True)
self.layer2 = SirenLayer(128, 64)
self.layer3 = SirenLayer(64, 32)
self.layer4 = SirenLayer(32, 24)
self.layer5 = SirenLayer(24, 32)
self.layer6 = SirenLayer(32, 64)
self.layer7 = SirenLayer(64, 128)
self.layer8 = SirenLayer(128, in_channels, is_last=True)
def forward(self, x):
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
latent = self.layer4(x)
x = self.layer5(latent)
x = self.layer6(x)
x = self.layer7(x)
x = self.layer8(x)
return x, latent
class RefineModelReLU(torch.nn.Module):
def __init__(self, in_channels):
super(RefineModelReLU, self).__init__()
self.layer1 = nn.Linear(in_channels, 128)
self.relu1 = nn.ReLU()
self.layer2 = nn.Linear(128, 64)
self.relu2 = nn.ReLU()
self.layer3 = nn.Linear(64, 4)
self.relu3 = nn.ReLU()
self.layer4 = nn.Linear(4, 64)
self.relu4 = nn.ReLU()
self.layer5 = nn.Linear(64, 128)
self.relu5 = nn.ReLU()
self.layer6 = nn.Linear(128, in_channels)
def forward(self, x):
x = self.relu1(self.layer1(x))
x = self.relu2(self.layer2(x))
latent = self.relu3(self.layer3(x))
x = self.relu4(self.layer4(latent))
x = self.relu5(self.layer5(x))
x = self.layer6(x)
return x, latent
class LatentPredModel(torch.nn.Module):
def __init__(self, in_channels):
super(LatentPredModel, self).__init__()
self.layer1 = nn.Linear(in_channels, 32)
self.relu1 = nn.ReLU()
self.layer2 = nn.Linear(32, 64)
self.relu2 = nn.ReLU()
self.layer3 = nn.Linear(64, 64)
self.relu3 = nn.ReLU()
self.layer4 = nn.Linear(64, 64)
self.relu4 = nn.ReLU()
self.layer5 = nn.Linear(64, 32)
self.relu5 = nn.ReLU()
self.layer6 = nn.Linear(32, in_channels)
def forward(self, x):
x = self.relu1(self.layer1(x))
x = self.relu2(self.layer2(x))
x = self.relu3(self.layer3(x))
x = self.relu4(self.layer4(x))
x = self.relu5(self.layer5(x))
x = self.layer6(x)
return x
| 34.560498
| 99
| 0.610977
| 2,714
| 19,423
| 4.184967
| 0.049742
| 0.053619
| 0.034337
| 0.01981
| 0.857105
| 0.844427
| 0.836415
| 0.828139
| 0.788255
| 0.736133
| 0
| 0.080327
| 0.263554
| 19,423
| 561
| 100
| 34.622103
| 0.713716
| 0
| 0
| 0.682105
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.077895
| false
| 0
| 0.008421
| 0
| 0.164211
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
5018c2d7419779f3e944e8a416f957ffabe33721
| 63
|
py
|
Python
|
www/speed/benchmarks/add_strings.py
|
raspberrypieman/brython
|
2cc23d1da6acda604d4a56b4c9d464eb7e374eda
|
[
"BSD-3-Clause"
] | 5,926
|
2015-01-01T07:45:08.000Z
|
2022-03-31T12:34:38.000Z
|
www/speed/benchmarks/add_strings.py
|
raspberrypieman/brython
|
2cc23d1da6acda604d4a56b4c9d464eb7e374eda
|
[
"BSD-3-Clause"
] | 1,728
|
2015-01-01T01:09:12.000Z
|
2022-03-30T23:25:22.000Z
|
www/speed/benchmarks/add_strings.py
|
raspberrypieman/brython
|
2cc23d1da6acda604d4a56b4c9d464eb7e374eda
|
[
"BSD-3-Clause"
] | 574
|
2015-01-02T01:36:10.000Z
|
2022-03-26T10:18:48.000Z
|
a, b, c = 'a', 'b', 'c'
for i in range(1000000):
a + b + c
| 15.75
| 24
| 0.428571
| 14
| 63
| 1.928571
| 0.571429
| 0.222222
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.162791
| 0.31746
| 63
| 3
| 25
| 21
| 0.465116
| 0
| 0
| 0
| 0
| 0
| 0.047619
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
501a92c5594c5c9d490f12afee2e38f8bfadec07
| 2,358
|
py
|
Python
|
regression_labs/sample_generator.py
|
miguelrfernandes/regressionLabs
|
849630019bbe3e56870341a284bc51c0b063bd13
|
[
"MIT"
] | null | null | null |
regression_labs/sample_generator.py
|
miguelrfernandes/regressionLabs
|
849630019bbe3e56870341a284bc51c0b063bd13
|
[
"MIT"
] | null | null | null |
regression_labs/sample_generator.py
|
miguelrfernandes/regressionLabs
|
849630019bbe3e56870341a284bc51c0b063bd13
|
[
"MIT"
] | null | null | null |
#!/usr/local/bin/python
import math
import numpy as np
class SampleGenerator:
def __init__(self):
self.c0 = np.random.random()*2
self.c1 = -np.random.random()*4
self.c2 = -np.random.random()*4
self.c3 = np.random.random()*4
def generate_non_linear_samples(self, x):
"""
Generate a noisy nonlinear data sample from a given data point in the range [0,1]
:param x: A scalar dependent variable for which to calculate the output y_noisy
:returns: The output with Gaussian noise added
"""
y = self.c0 - x - math.sin(self.c1 * math.pi * x ** 3) * math.cos(self.c2 * math.pi * x ** 3) * math.exp(-x ** 4)
sigma = 0.3
noise = sigma * np.random.random()
y_noisy = y + noise
return y_noisy
def generate_linear_samples(self, x):
"""
Generate a noisy linear data sample from a given data point in the range [0,1]
:param x: A scalar dependent variable for which to calculate the output y_noisy
:returns: The output with Gaussian noise added
"""
y = self.c3 * x + self.c1
sigma = 0.5
noise = sigma * np.random.random()
y_noisy = y + noise
return y_noisy
def generate_non_linear_samples2(self, x, sigma):
"""
Generate a noisy nonlinear data sample from a given data point in the range [0,1]
:param x: A scalar dependent variable for which to calculate the output y_noisy
:returns: The output with Gaussian noise added
"""
y = self.c0 - x - math.sin(self.c1 * math.pi * x ** 3) * math.cos(self.c2 * math.pi * x ** 3) * math.exp(-x ** 4)
#sigma = 0.3
noise = sigma * np.random.random()
y_noisy = y + noise
return y_noisy
def generate_linear_samples2(self, x, sigma):
"""
Generate a noisy linear data sample from a given data point in the range [0,1]
:param x: A scalar dependent variable for which to calculate the output y_noisy
:returns: The output with Gaussian noise added
"""
y = self.c3 * x + self.c1
print(f"Sigma Changed in Linear = {sigma}")
#sigma = 0.5
noise = sigma * np.random.random()
y_noisy = y + noise
return y_noisy
| 32.30137
| 121
| 0.581849
| 342
| 2,358
| 3.935673
| 0.192982
| 0.053492
| 0.08321
| 0.044577
| 0.875929
| 0.847697
| 0.847697
| 0.825409
| 0.794205
| 0.794205
| 0
| 0.026234
| 0.321035
| 2,358
| 72
| 122
| 32.75
| 0.814491
| 0.378287
| 0
| 0.516129
| 0
| 0
| 0.025923
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.16129
| false
| 0
| 0.064516
| 0
| 0.387097
| 0.032258
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 6
|
acab5db46bb8ededf4b187bb83e3ec2a35fce321
| 109
|
py
|
Python
|
app/users/exceptions.py
|
ExiledNarwal28/glo-2005-project
|
3b5b5f9cdcfe53d1e6e702609587068c4bd3310d
|
[
"MIT"
] | null | null | null |
app/users/exceptions.py
|
ExiledNarwal28/glo-2005-project
|
3b5b5f9cdcfe53d1e6e702609587068c4bd3310d
|
[
"MIT"
] | null | null | null |
app/users/exceptions.py
|
ExiledNarwal28/glo-2005-project
|
3b5b5f9cdcfe53d1e6e702609587068c4bd3310d
|
[
"MIT"
] | 1
|
2020-05-21T10:07:07.000Z
|
2020-05-21T10:07:07.000Z
|
class UserNotFoundException(Exception):
pass
class UserAlreadyRegisteredException(Exception):
pass
| 15.571429
| 48
| 0.798165
| 8
| 109
| 10.875
| 0.625
| 0.298851
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.146789
| 109
| 6
| 49
| 18.166667
| 0.935484
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 1
| 0
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 6
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.