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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1bcfde6f2e7e3b6d5e886265903731eb5376b4e9
| 1,889
|
py
|
Python
|
test2.py
|
YANGYANTEST/chunyun
|
1d2b341a267d867c60ccfe6592e4120248e055c4
|
[
"MIT"
] | null | null | null |
test2.py
|
YANGYANTEST/chunyun
|
1d2b341a267d867c60ccfe6592e4120248e055c4
|
[
"MIT"
] | null | null | null |
test2.py
|
YANGYANTEST/chunyun
|
1d2b341a267d867c60ccfe6592e4120248e055c4
|
[
"MIT"
] | null | null | null |
import requests
date="2018-01-19"
fromstation="hangzhou"
tostation="shanghai"
url='https://kyfw.12306.cn/otn/leftTicket/queryZ?leftTicketDTO.train_date={}&leftTicketDTO.from_station={}BJP&leftTicketDTO.to_station={}&purpose_codes=ADULT'.format(date,fromstation,tostation)
print(url)
# r=requests.get(url)
# print(r.json())
#https://kyfw.12306.cn/otn/leftTicket/queryZ?leftTicketDTO.train_date=2018-01-09&leftTicketDTO.from_station=hangzhouBJP&leftTicketDTO.to_station=shanghai&purpose_codes=ADULT
#https://kyfw.12306.cn/otn/leftTicket/queryZ?leftTicketDTO.train_date=2018-01-09&leftTicketDTO.from_station=hangzhouBJP&leftTicketDTO.to_station=shanghai&purpose_codes=ADULT
# https://kyfw.12306.cn/otn/leftTicket/queryZ?leftTicketDTO.train_date=2018-01-09&leftTicketDTO.from_station= 上海BJP&leftTicketDTO.to_station=北京&purpose_codes=ADULT
"""
'@bjb|北京北|VAP|beijingbei|bjb|0@bjd|北京东|BOP|beijingdong|bjd|1@bji|北京|BJP|beijing|bj|2@bjn|北京南|VNP|beijingnan|bjn|3@bjx|北京西|BXP|beijingxi|bjx|4@gzn|广州南|IZQ|guangzhounan|gzn|5@cqb|重庆北|CUW|chongqingbei|cqb|6@cqi|重庆|CQW|chongqing|cq|7@cqn|重庆南|CRW|chongqingnan|cqn|8@gzd|广州东|GGQ|guangzhoudong|gzd|9@sha|上海|SHH|shanghai|sh|10@shn|上海南|SNH|shanghainan|shn|11@shq|上海虹桥|AOH|shanghaihongqiao|shhq|12@shx|上海西|SXH|shanghaixi|shx|13@tjb|天津北|TBP|tianjinbei|tjb|14@tji|天津|TJP|tianjin|tj|15@tjn|天津
||
{
"北京北":"VAP"
"北京东":"BOP"
}
"""
def parse_stations():
station="@bjb|北京北|VAP|beijingbei|bjb|0@bjd|北京东|BOP|beijingdong|bjd|1@bji|北京|BJP|beijing|bj|2@bjn|北京南|VNP|beijingnan|bjn|3@bjx|北京西|BXP|beijingxi|bjx|4@gzn|广州南|IZQ|guangzhounan|gzn|5@cqb|重庆北|CUW|chongqingbei|cqb|6@cqi|重庆|CQW|chongqing|cq|7@cqn|重庆南|CRW|chongqingnan|cqn|8@gzd|广州东|GGQ|guangzhoudong|gzd|9@sha|上海|SHH|shanghai|sh|10@shn|上海南|SNH|shanghainan|shn|11@shq|上海虹桥|AOH|shanghaihongqiao|shhq|12@shx|上海西|SXH|shanghaixi|shx|13@tjb|天津北|TBP|tianjinbei|tjb|14@tji|天津|TJP|tianjin|tj|15@tjn|天津"
| 62.966667
| 492
| 0.789836
| 320
| 1,889
| 4.609375
| 0.38125
| 0.021695
| 0.027119
| 0.04339
| 0.813559
| 0.813559
| 0.813559
| 0.813559
| 0.813559
| 0.813559
| 0
| 0.052231
| 0.026998
| 1,889
| 30
| 493
| 62.966667
| 0.750272
| 0.286395
| 0
| 0
| 0
| 0.25
| 0.803922
| 0.585784
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| false
| 0
| 0.125
| 0
| 0.25
| 0.125
| 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
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
1bd6af6ab3b81a356dcca93bb17f6fd5adf25ded
| 19,582
|
py
|
Python
|
autogalaxy/profiles/light_profiles/light_profiles_snr.py
|
caoxiaoyue/PyAutoGalaxy
|
ad2b4b27404f5bf0f65ba9a0cd7c3ee6570e2d05
|
[
"MIT"
] | null | null | null |
autogalaxy/profiles/light_profiles/light_profiles_snr.py
|
caoxiaoyue/PyAutoGalaxy
|
ad2b4b27404f5bf0f65ba9a0cd7c3ee6570e2d05
|
[
"MIT"
] | null | null | null |
autogalaxy/profiles/light_profiles/light_profiles_snr.py
|
caoxiaoyue/PyAutoGalaxy
|
ad2b4b27404f5bf0f65ba9a0cd7c3ee6570e2d05
|
[
"MIT"
] | null | null | null |
import numpy as np
from typing import Tuple
import autoarray as aa
from autogalaxy.profiles.light_profiles import light_profiles as lp
from scipy.optimize import root_scalar
class LightProfileSNR:
def __init__(self, signal_to_noise_ratio: float = 10.0):
"""
This light profile class sets the `intensity` of the light profile using input noise properties of a simulation
(e.g. using the `exposure_time`, `background_sky_level`).
This means that the intensities of the light profiles can be automatically adjusted when an `SimulatorImaging`
object is used to simulate imaging data, whereby the intensity of each light profile is set to produce an
image with the input `signal_to_noise_ratio` of this class.
The brightest pixel of the image of the light profile is used to do this, thus the S/N in all other pixels
away from the brightest pixel will be below the input `signal_to_noise_ratio`.
The intensity is set using an input grid, meaning that for strong lensing calculations the ray-traced grid
can be used such that the S/N accounts for the magnification of a source galaxy.
Parameters
----------
signal_to_noise_ratio
The signal-to-noises ratio that the simulated light profile will produce.
"""
self.signal_to_noise_ratio = signal_to_noise_ratio
def image_2d_from(self, grid: aa.type.Grid2DLike) -> aa.Array2D:
"""
Abstract method for obtaining intensity at a grid of Cartesian (y,x) coordinates.
Parameters
----------
grid
The (y, x) coordinates in the original reference frame of the grid.
Returns
-------
image
The image of the `LightProfile` evaluated at every (y,x) coordinate on the grid.
"""
raise NotImplementedError()
def set_intensity_from(
self,
grid: aa.type.Grid2DLike,
exposure_time: float,
background_sky_level: float = 0.0,
):
"""
Set the `intensity` of the light profile as follows:
- Evaluate the image of the light profile on an input grid.
- Take the value of the brightest pixel.
- Use an input `exposure_time` and `background_sky` (e.g. from the `SimulatorImaging` object) to determine
what value of `intensity` gives the desired signal to noise ratio for the image.
The intensity is set using an input grid, meaning that for strong lensing calculations the ray-traced grid
can be used such that the S/N accounts for the magnification of a source galaxy.
Parameters
----------
grid
The (y, x) coordinates in the original reference frame of the grid.
exposure_time
The exposure time of the simulated imaging.
background_sky_level
The level of the background sky of the simulated imaging.
"""
self.intensity = 1.0
background_sky_level_counts = background_sky_level * exposure_time
brightest_value = np.max(self.image_2d_from(grid=grid))
def func(intensity_factor):
signal = intensity_factor * brightest_value * exposure_time
noise = np.sqrt(signal + background_sky_level_counts)
return signal / noise - self.signal_to_noise_ratio
intensity_factor = root_scalar(func, bracket=[1.0e-8, 1.0e8]).root
self.intensity *= intensity_factor
class EllGaussian(lp.EllGaussian, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
elliptical_comps: Tuple[float, float] = (0.0, 0.0),
sigma: float = 0.01,
):
"""
The elliptical Gaussian light profile.
Parameters
----------
centre
The (y,x) arc-second coordinates of the profile centre.
elliptical_comps
The first and second ellipticity components of the elliptical coordinate system, (see the module
`autogalaxy -> convert.py` for the convention).
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
sigma
The sigma value of the Gaussian, corresponding to ~ 1 / sqrt(2 log(2)) the full width half maximum.
"""
super().__init__(
centre=centre, elliptical_comps=elliptical_comps, intensity=0.0, sigma=sigma
)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class SphGaussian(lp.SphGaussian, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
sigma: float = 0.01,
):
"""
The spherical Gaussian light profile.
Parameters
----------
centre
The (y,x) arc-second coordinates of the profile centre.
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
sigma
The sigma value of the Gaussian, corresponding to ~ 1 / sqrt(2 log(2)) the full width half maximum.
"""
super().__init__(centre=centre, intensity=0.0, sigma=sigma)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class EllSersic(lp.EllSersic, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
elliptical_comps: Tuple[float, float] = (0.0, 0.0),
effective_radius: float = 0.6,
sersic_index: float = 4.0,
):
"""
An elliptical Sersic light profile.
Instead of an `intensity` a `signal_to_noise_ratio` is input which sets the signal to noise of the brightest
pixel of the profile's image when used to simulate imaging data.
Parameters
----------
signal_to_noise_ratio
The signal to noise of the light profile when it is used to simulate strong lens imaging.
centre
The (y,x) arc-second coordinates of the profile centre.
elliptical_comps
The first and second ellipticity components of the elliptical coordinate system, (see the module
`autogalaxy -> convert.py` for the convention).
effective_radius
The circular radius containing half the light of this profile.
sersic_index
Controls the concentration of the profile (lower -> less concentrated, higher -> more concentrated).
"""
super().__init__(
centre=centre,
elliptical_comps=elliptical_comps,
intensity=0.0,
effective_radius=effective_radius,
sersic_index=sersic_index,
)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class SphSersic(lp.SphSersic, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
effective_radius: float = 0.6,
sersic_index: float = 4.0,
):
"""
The spherical Sersic light profile.
Parameters
----------
centre
The (y,x) arc-second coordinates of the profile centre.
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
effective_radius
The circular radius containing half the light of this profile.
sersic_index
Controls the concentration of the of the light profile.
"""
super().__init__(
centre=centre,
intensity=0.0,
effective_radius=effective_radius,
sersic_index=sersic_index,
)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class EllExponential(lp.EllExponential, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
elliptical_comps: Tuple[float, float] = (0.0, 0.0),
effective_radius: float = 0.6,
):
"""
The elliptical exponential profile.
This is a subset of the elliptical Sersic profile, specific to the case that sersic_index = 1.0.
Parameters
----------
centre
The (y,x) arc-second centre of the light profile.
elliptical_comps
The first and second ellipticity components of the elliptical coordinate system, (see the module
`autogalaxy -> convert.py` for the convention).
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
effective_radius
The circular radius containing half the light of this profile.
"""
super().__init__(
centre=centre,
elliptical_comps=elliptical_comps,
intensity=0.0,
effective_radius=effective_radius,
)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class SphExponential(lp.SphExponential, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
effective_radius: float = 0.6,
):
"""
The spherical exponential profile.
This is a subset of the elliptical Sersic profile, specific to the case that sersic_index = 1.0.
Parameters
----------
centre
The (y,x) arc-second coordinates of the profile centre.
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
effective_radius
The circular radius containing half the light of this profile.
"""
super().__init__(centre=centre, effective_radius=effective_radius)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class EllDevVaucouleurs(lp.EllDevVaucouleurs, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
elliptical_comps: Tuple[float, float] = (0.0, 0.0),
effective_radius: float = 0.6,
):
"""
The elliptical Dev Vaucouleurs light profile.
This is a subset of the elliptical Sersic profile, specific to the case that sersic_index = 4.0.
Parameters
----------
centre
The (y,x) arc-second coordinates of the profile centre.
elliptical_comps
The first and second ellipticity components of the elliptical coordinate system, (see the module
`autogalaxy -> convert.py` for the convention).
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
effective_radius
The circular radius containing half the light of this profile.
"""
super().__init__(
centre=centre,
elliptical_comps=elliptical_comps,
intensity=0.0,
effective_radius=effective_radius,
)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class SphDevVaucouleurs(lp.SphDevVaucouleurs, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
effective_radius: float = 0.6,
):
"""
The spherical Dev Vaucouleurs light profile.
This is a subset of the elliptical Sersic profile, specific to the case that sersic_index = 1.0.
Parameters
----------
centre
The (y,x) arc-second coordinates of the profile centre.
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
effective_radius
The circular radius containing half the light of this profile.
"""
super().__init__(
centre=centre, intensity=0.0, effective_radius=effective_radius
)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class EllChameleon(lp.EllChameleon, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
elliptical_comps: Tuple[float, float] = (0.0, 0.0),
core_radius_0: float = 0.01,
core_radius_1: float = 0.05,
):
"""
The elliptical Chameleon light profile.
Profile form:
mass_to_light_ratio * intensity *\
(1.0 / Sqrt(x^2 + (y/q)^2 + rc^2) - 1.0 / Sqrt(x^2 + (y/q)^2 + (rc + dr)**2.0))
Parameters
----------
centre
The (y,x) arc-second coordinates of the profile centre.
elliptical_comps
The first and second ellipticity components of the elliptical coordinate system, (see the module
`autogalaxy -> convert.py` for the convention).
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
core_radius_0 : the core size of the first elliptical cored Isothermal profile.
core_radius_1 : rc + dr is the core size of the second elliptical cored Isothermal profile.
We use dr here is to avoid negative values.
"""
super().__init__(
centre=centre,
elliptical_comps=elliptical_comps,
intensity=0.0,
core_radius_0=core_radius_0,
core_radius_1=core_radius_1,
)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class SphChameleon(lp.SphChameleon, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
core_radius_0: float = 0.01,
core_radius_1: float = 0.05,
):
"""
The spherical Chameleon light profile.
Profile form:
mass_to_light_ratio * intensity *\
(1.0 / Sqrt(x^2 + (y/q)^2 + rc^2) - 1.0 / Sqrt(x^2 + (y/q)^2 + (rc + dr)**2.0))
Parameters
----------
centre
The (y,x) arc-second coordinates of the profile centre.
elliptical_comps
The first and second ellipticity components of the elliptical coordinate system, (see the module
`autogalaxy -> convert.py` for the convention).
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
core_radius_0 : the core size of the first elliptical cored Isothermal profile.
core_radius_1 : rc + dr is the core size of the second elliptical cored Isothermal profile.
We use dr here is to avoid negative values.
"""
super().__init__(
centre=centre,
intensity=0.0,
core_radius_0=core_radius_0,
core_radius_1=core_radius_1,
)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class EllEff(lp.EllEff, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
elliptical_comps: Tuple[float, float] = (0.0, 0.0),
effective_radius: float = 0.6,
eta: float = 1.5,
):
"""
The elliptical eff light profile, which is commonly used to represent the clumps of Lyman-alpha emitter
galaxies.
Parameters
----------
centre
The (y,x) arc-second coordinates of the profile centre.
elliptical_comps
The first and second ellipticity components of the elliptical coordinate system, (see the module
`autogalaxy -> convert.py` for the convention).
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
effective_radius
The circular radius containing half the light of this profile.
eta
Scales the intensity gradient of the profile.
"""
super().__init__(
centre=centre,
elliptical_comps=elliptical_comps,
intensity=0.0,
effective_radius=effective_radius,
eta=eta,
)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
class SphEff(lp.SphEff, LightProfileSNR):
def __init__(
self,
signal_to_noise_ratio: float = 10.0,
centre: Tuple[float, float] = (0.0, 0.0),
effective_radius: float = 0.6,
eta: float = 1.5,
):
"""
The spherical eff light profile, which is commonly used to represent the clumps of Lyman-alpha emitter
galaxies.
This profile is introduced in the following paper:
https://arxiv.org/abs/1708.08854
Parameters
----------
centre
The (y,x) arc-second coordinates of the profile centre.
intensity
Overall intensity normalisation of the light profile (units are dimensionless and derived from the data
the light profile's image is compared too, which is expected to be electrons per second).
effective_radius
The circular radius containing half the light of this profile.
"""
super().__init__(
centre=centre, intensity=0.0, effective_radius=effective_radius, eta=eta
)
LightProfileSNR.__init__(self, signal_to_noise_ratio=signal_to_noise_ratio)
| 39.559596
| 120
| 0.619089
| 2,382
| 19,582
| 4.91016
| 0.106213
| 0.011286
| 0.053352
| 0.070793
| 0.816518
| 0.807114
| 0.785995
| 0.785995
| 0.780181
| 0.776761
| 0
| 0.018572
| 0.309825
| 19,582
| 494
| 121
| 39.639676
| 0.846837
| 0.504085
| 0
| 0.730159
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.084656
| false
| 0
| 0.026455
| 0
| 0.185185
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
940798838107d30e16b395ff17ec45e35c2a9806
| 20,970
|
py
|
Python
|
biserici_inlemnite/app/migrations/0050_auto_20210927_1505.py
|
ck-tm/biserici-inlemnite
|
c9d12127b92f25d3ab2fcc7b4c386419fe308a4e
|
[
"MIT"
] | null | null | null |
biserici_inlemnite/app/migrations/0050_auto_20210927_1505.py
|
ck-tm/biserici-inlemnite
|
c9d12127b92f25d3ab2fcc7b4c386419fe308a4e
|
[
"MIT"
] | null | null | null |
biserici_inlemnite/app/migrations/0050_auto_20210927_1505.py
|
ck-tm/biserici-inlemnite
|
c9d12127b92f25d3ab2fcc7b4c386419fe308a4e
|
[
"MIT"
] | null | null | null |
# Generated by Django 3.1.13 on 2021-09-27 12:05
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0023_add_choose_permissions'),
('app', '0049_pozealtar_pozeiconostas_pozeperetedespartitor_pozepicturaexterioara_pozepicturainterioara'),
]
operations = [
migrations.AlterField(
model_name='pozeturn',
name='page',
field=modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_turn', to='app.conservarepage'),
),
migrations.CreateModel(
name='PozeZonaDinJurulBiserici',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_zona_din_jurul_biserici', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeVegetatie',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_vegetatie', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeTeren',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_teren', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeTamplarii',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_tamplarii', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeTalpi',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_talpi', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeStratPictural',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_strat_pictural', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeSit',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_sit', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeSarpantaCorpBiserica',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_sarpanta_corp_biserica', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozePardoseliInterioare',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_pardoseli_interioare', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeParatraznet',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_paratraznet', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeMobilier',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_mobilier', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeInvelitoareSarpantaSiTurn',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_invelitoare_sarpanta_si_turn', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeInstalatieTermica',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_instalatie_termica', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeInstalatieElectrica',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_instalatie_electrica', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeFundatii',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_fundatii', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeFinisajTavaneSiBolti',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_finisaj_tavane_si_bolti', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeFinisajPeretiInteriori',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_finisaj_pereti_interiori', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeFinisajExterior',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_finisaj_exterior', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeElementeArhitecturale',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_elemente_arhitecturale', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeCosoroabe',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_cosoroabe', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeCorpBiserica',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_corp_biserica', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeBolti',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_bolti', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
migrations.CreateModel(
name='PozeAlteElementeImportante',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('observatii', wagtail.core.fields.RichTextField(blank=True, null=True, verbose_name='Observații')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='poze_alte_elemente_importante', to='app.conservarepage')),
('poza', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
]
| 60.782609
| 178
| 0.60434
| 2,050
| 20,970
| 6.030732
| 0.066829
| 0.050231
| 0.054356
| 0.085416
| 0.912885
| 0.912885
| 0.912885
| 0.912885
| 0.912885
| 0.912885
| 0
| 0.001525
| 0.249642
| 20,970
| 344
| 179
| 60.959302
| 0.784175
| 0.002194
| 0
| 0.751479
| 1
| 0
| 0.166189
| 0.031594
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.017751
| 0
| 0.026627
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
846f5511c7cd13ebe2bbc394dec148e431e88b00
| 2,120
|
py
|
Python
|
SubX/compute_subx_anom.py
|
Sijie-umn/SSF-MIP
|
89636846cc11950c9fd851e58ea410cef72d9b90
|
[
"MIT"
] | 6
|
2021-10-18T01:16:57.000Z
|
2022-03-18T07:32:00.000Z
|
SubX/compute_subx_anom.py
|
Sijie-umn/SSF-MIP
|
89636846cc11950c9fd851e58ea410cef72d9b90
|
[
"MIT"
] | null | null | null |
SubX/compute_subx_anom.py
|
Sijie-umn/SSF-MIP
|
89636846cc11950c9fd851e58ea410cef72d9b90
|
[
"MIT"
] | 2
|
2021-12-27T01:40:02.000Z
|
2022-01-17T12:32:13.000Z
|
from netCDF4 import Dataset
import pandas as pd
import numpy as np
for model in ['NCEP', 'GMAO']:
tmp2m_week34 = pd.read_hdf('tmp2m_{}.h5'.format(model)).reset_index()
tmp2m_week34_climo = pd.read_hdf('tmp2m_{}_climo.h5'.format(model))
tmp2m_week34_climo['climo'] = tmp2m_week34_climo['tmp2m']
tmp2m_week34_climo = tmp2m_week34_climo.drop('tmp2m', axis=1)
tmp2m_week34['month'] = tmp2m_week34.start_date.dt.month
tmp2m_week34['day'] = tmp2m_week34.start_date.dt.day
tmp2m_week34 = tmp2m_week34.merge(tmp2m_week34_climo, on=['lat', 'lon', 'month', 'day'], how='left')
tmp2m_week34['{}_anom'.format(model)] = tmp2m_week34['tmp2m'] - tmp2m_week34['climo']
tmp2m_week34 = tmp2m_week34.drop(['month', 'day'], axis=1)
tmp2m_week34 = tmp2m_week34.rename(columns={"tmp2m": "tmp2m_week34", "climo": "climo_week34", "{}_anom".format(model): "{}_anom_week34".format(model)})
tmp2m_week34 = tmp2m_week34.set_index(['lat', 'lon', 'start_date'])
tmp2m_week34 = tmp2m_week34.sort_index()
tmp2m_week34.to_hdf('tmp2m_{}_week34_forecast.h5'.format(model), key='data')
tmp2m_week34 = pd.read_hdf('tmp2m_{}_hindcast.h5'.format(model)).reset_index()
tmp2m_week34_climo = pd.read_hdf('tmp2m_{}_climo.h5'.format(model))
tmp2m_week34_climo['climo'] = tmp2m_week34_climo['tmp2m']
tmp2m_week34_climo = tmp2m_week34_climo.drop('tmp2m', axis=1)
tmp2m_week34['month'] = tmp2m_week34.start_date.dt.month
tmp2m_week34['day'] = tmp2m_week34.start_date.dt.day
tmp2m_week34 = tmp2m_week34.merge(tmp2m_week34_climo, on=['lat', 'lon', 'month', 'day'], how='left')
tmp2m_week34['{}_anom'.format(model)] = tmp2m_week34['tmp2m'] - tmp2m_week34['climo']
tmp2m_week34 = tmp2m_week34.drop(['month', 'day'], axis=1)
tmp2m_week34 = tmp2m_week34.rename(columns={"tmp2m": "tmp2m_week34", "climo": "climo_week34", "{}_anom".format(model): "{}_anom_week34".format(model)})
tmp2m_week34 = tmp2m_week34.set_index(['lat', 'lon', 'start_date'])
tmp2m_week34 = tmp2m_week34.sort_index()
tmp2m_week34.to_hdf('tmp2m_{}_week34_hindcast.h5'.format(model), key='data')
| 58.888889
| 155
| 0.713208
| 298
| 2,120
| 4.721477
| 0.157718
| 0.422175
| 0.181947
| 0.156361
| 0.931059
| 0.90263
| 0.867093
| 0.867093
| 0.867093
| 0.867093
| 0
| 0.102442
| 0.111321
| 2,120
| 35
| 156
| 60.571429
| 0.644374
| 0
| 0
| 0.733333
| 0
| 0
| 0.192925
| 0.025472
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.1
| 0
| 0.1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 1
| 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
| 9
|
848fbcfbd996f24ac332bfad27929748b792b85b
| 4,092
|
py
|
Python
|
pasd/conversion.py
|
andreww5au/PaSD-client
|
5ed7ff3e8b529c440fbfecb8c3159516285496c4
|
[
"MIT"
] | null | null | null |
pasd/conversion.py
|
andreww5au/PaSD-client
|
5ed7ff3e8b529c440fbfecb8c3159516285496c4
|
[
"MIT"
] | null | null | null |
pasd/conversion.py
|
andreww5au/PaSD-client
|
5ed7ff3e8b529c440fbfecb8c3159516285496c4
|
[
"MIT"
] | null | null | null |
"""
Scaling functions that take PCB and modbus register version numbers, and convert raw
register values into real values.
"""
def scale_5v(value, reverse=False, pcb_version=0):
"""
Given a raw register value and the PCB version number, find out what scale and offset are needed, convert the raw
value to a voltage (if reverse=False), or convert a value in Volts to raw (if reverse=True).
For now, raw values are hundredths of a volt, positive only.
:param value: raw register contents as a value from 0-65535, or a voltage in Volts
:param reverse: Boolean, True to perform physical->raw conversion instead of raw->physical
:param pcb_version: integer PCB version number, 0-65535
:return: output_value in Volts
"""
if reverse:
return int(value * 100) & 0xFFFF
else:
return value / 100.0
def scale_48v(value, reverse=False, pcb_version=0):
"""
Given a raw register value and the PCB version number, find out what scale and offset are needed, convert the raw
value to a voltage (if reverse=False), or convert a value in Volts to raw (if reverse=True).
For now, raw values are hundredths of a volt, positive only.
:param value: raw register contents as a value from 0-65535, or a voltage in Volts
:param reverse: Boolean, True to perform physical->raw conversion instead of raw->physical
:param pcb_version: integer PCB version number, 0-65535
:return: output_value in Volts
"""
if reverse:
return int(value * 100) & 0xFFFF
else:
return value / 100.0
def scale_temp(value, reverse=False, pcb_version=0):
"""
Given a raw register value and the PCB version number, find out what scale and offset are needed, convert the raw
value to deg C (if reverse=False), or convert a value in deg C to raw (if reverse=True).
For now, raw values are hundredths of a deg C, as a signed 16-bit integer value
:param value: raw register contents as a value from 0-65535, or a floating point temperature in degrees
:param reverse: Boolean, True to perform physical->raw conversion instead of raw->physical
:param pcb_version: integer PCB version number, 0-65535
:return: value in deg C (if reverse=False), or raw value as an unsigned 16 bit integer
"""
if reverse:
if value < 0:
return (int(value * 100) + 65536) & 0xFFFF
else:
return int(value * 100) & 0xFFFF
else:
if value >= 32768:
value -= 65536
return value / 100.0 # raw_value is a signed 16-bit integer containing temp in 1/100th of a degree
# TODO - fix all the uses (and simulated ports in sim_smartbox) to use no conversion, raw ADU values
def scale_FEMcurrent(value, reverse=False, pcb_version=0):
"""
Given a raw register value and the PCB version number, find out what scale and offset are needed, convert the raw
value to mA.
Note that for now, this returns the value unchanged, in both directions, until we settle on a final representation.
:param value: raw register contents as a value from 0-65535, or crude estimate of the current in Amps
:param reverse: Boolean, True to perform physical->raw conversion instead of raw->physical
:param pcb_version: integer PCB version number, 0-65535
:return: output_value in mA
"""
return value
def scale_48vcurrent(value, reverse=False, pcb_version=0):
"""
Given a raw register value and the PCB version number, find out what scale and offset are needed, convert the raw
value to Amps (if reverse=False), or convert a value in Amps to raw (if reverse=True).
For now, raw values are hundredths of an Amp, positive only.
:param value: raw register contents as a value from 0-65535, or current in Amps
:param reverse: Boolean, True to perform physical->raw conversion instead of raw->physical
:param pcb_version: integer PCB version number, 0-65535
:return: output_value in Amps
"""
if reverse:
return int(value * 100) & 0xFFFF
else:
return value / 100.0
| 41.755102
| 119
| 0.699413
| 642
| 4,092
| 4.425234
| 0.17757
| 0.070398
| 0.056318
| 0.035199
| 0.794087
| 0.780711
| 0.76276
| 0.76276
| 0.740936
| 0.740936
| 0
| 0.042065
| 0.233138
| 4,092
| 97
| 120
| 42.185567
| 0.863289
| 0.738514
| 0
| 0.62963
| 0
| 0
| 0
| 0
| 0
| 0
| 0.034642
| 0.010309
| 0
| 1
| 0.185185
| false
| 0
| 0
| 0
| 0.555556
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 7
|
04dea5e5dcd04a26839cc140c621f7661afacef1
| 164
|
py
|
Python
|
partial_date/__init__.py
|
jherskovic/django_partial_date
|
ecd98344f6512281c425277a18a7ff91260458a6
|
[
"MIT"
] | null | null | null |
partial_date/__init__.py
|
jherskovic/django_partial_date
|
ecd98344f6512281c425277a18a7ff91260458a6
|
[
"MIT"
] | null | null | null |
partial_date/__init__.py
|
jherskovic/django_partial_date
|
ecd98344f6512281c425277a18a7ff91260458a6
|
[
"MIT"
] | null | null | null |
from partial_date.fields import PartialDate, PartialDateField
from partial_date.forms import PartialDateFormField
from partial_date.widget import PartialDateWidget
| 41
| 61
| 0.896341
| 19
| 164
| 7.578947
| 0.578947
| 0.229167
| 0.3125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.079268
| 164
| 3
| 62
| 54.666667
| 0.953642
| 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
| 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
| 7
|
b6bfd45374c9b443edf712ab693da67e4ce46883
| 47
|
py
|
Python
|
src/lib/test/decimaltestdata/__init__.py
|
DTenore/skulpt
|
098d20acfb088d6db85535132c324b7ac2f2d212
|
[
"MIT"
] | 2,671
|
2015-01-03T08:23:25.000Z
|
2022-03-31T06:15:48.000Z
|
src/lib/test/decimaltestdata/__init__.py
|
wakeupmuyunhe/skulpt
|
a8fb11a80fb6d7c016bab5dfe3712517a350b347
|
[
"MIT"
] | 972
|
2015-01-05T08:11:00.000Z
|
2022-03-29T13:47:15.000Z
|
src/lib/test/decimaltestdata/__init__.py
|
wakeupmuyunhe/skulpt
|
a8fb11a80fb6d7c016bab5dfe3712517a350b347
|
[
"MIT"
] | 845
|
2015-01-03T19:53:36.000Z
|
2022-03-29T18:34:22.000Z
|
import _sk_fail; _sk_fail._("decimaltestdata")
| 23.5
| 46
| 0.808511
| 6
| 47
| 5.5
| 0.666667
| 0.363636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.06383
| 47
| 1
| 47
| 47
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0.319149
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 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
| 7
|
8e0538de4a184c00078ea0df2f27fe533441604d
| 3,631
|
py
|
Python
|
SimTools/broken.test_ORF_eliminator.py
|
ShepherdCode/Soars2021
|
ab4f304eaa09e52d260152397a6c53d7a05457da
|
[
"MIT"
] | 1
|
2021-08-16T14:49:04.000Z
|
2021-08-16T14:49:04.000Z
|
SimTools/broken.test_ORF_eliminator.py
|
ShepherdCode/Soars2021
|
ab4f304eaa09e52d260152397a6c53d7a05457da
|
[
"MIT"
] | null | null | null |
SimTools/broken.test_ORF_eliminator.py
|
ShepherdCode/Soars2021
|
ab4f304eaa09e52d260152397a6c53d7a05457da
|
[
"MIT"
] | null | null | null |
import pytest
from ORF_eliminator import ORF_eliminator
from RNA_describe import RNA_describer
from RNA_describe import ORF_counter
from RNA_describe import ORF_RE
class Test_ORF_eliminator:
'''
Test to see if ORF_eliminator recreates the sequence
without ORF!
In rna, clearly we have a ORF of length 6.
We will check if goes down to 0 using get_coordinate function.
Also, we will check the length to see if the length of new
RNA is same or not.
'''
def test_method1(self):
rna = 'ATGAAATAG'
length_rna = len(rna)
data = ORF_eliminator(rna)
newRNA = data.eliminate_ORF()
length_new_rna = len(newRNA)
coordinates =data.get_coordinates()
length_of_orfs = coordinates[1]
ans = 0
msg ='Removed!'
msg2 = 'Both RNA are of same length!'
assert length_of_orfs == ans , msg
assert length_rna == length_new_rna ,msg2
'''
This time, lets make the RNA with just codon TAG
rna = 'TAGTAGTAGTAGTAG'
'''
def test_method2(self):
rna = 'TAGTAGTAGTAGTAG'
data = ORF_eliminator(rna)
newRNA = data.eliminate_ORF()
coordinate =data.get_coordinates()
length = coordinate[1]
ans = 0
msg ='Removed!'
assert length == ans , msg
length_rna = len(rna)
length_new_rna = len(newRNA)
msg2 = 'Both RNA are of same length!'
assert length_rna == length_new_rna ,msg2
'''
Lets use letter T all the time to see if the
program fails.
'''
def test_method3(self):
rna = 'TTTTTTTTTTTTTTT'
data = ORF_eliminator(rna)
newRNA = data.eliminate_ORF()
coordinate =data.get_coordinates()
length = coordinate[1]
ans = 0
msg ='Removed!'
assert length == ans , msg
length_rna = len(rna)
length_new_rna = len(newRNA)
msg2 = 'Both RNA are of same length!'
assert length_rna == length_new_rna ,msg2
def test_method4(self):
rna = 'ATGAAATAG'
length_rna = len(rna)
data = ORF_eliminator(rna)
newRNA = data.eliminate_ORF2()
length_new_rna = len(newRNA)
coordinates =data.get_coordinates()
length_of_orfs = coordinates[1]
ans = 0
msg ='Removed!'
msg2 = 'Both RNA are of same length!'
assert length_of_orfs == ans , msg
assert length_rna == length_new_rna ,msg2
'''
This time, lets make the RNA with just codon TAG
rna = 'TAGTAGTAGTAGTAG'
'''
def test_method5(self):
rna = 'TAGTAGTAGTAGTAG'
data = ORF_eliminator(rna)
newRNA = data.eliminate_ORF2()
coordinate =data.get_coordinates()
length = coordinate[1]
ans = 0
msg ='Removed!'
assert length == ans , msg
length_rna = len(rna)
length_new_rna = len(newRNA)
msg2 = 'Both RNA are of same length!'
assert length_rna == length_new_rna ,msg2
'''
Lets use letter T all the time to see if the
program fails.
'''
def test_method6(self):
rna = 'TTTTTTTTTTTTTTT'
data = ORF_eliminator(rna)
newRNA = data.eliminate_ORF2()
coordinate =data.get_coordinates()
length = coordinate[1]
ans = 0
msg ='Removed!'
assert length == ans , msg
length_rna = len(rna)
length_new_rna = len(newRNA)
msg2 = 'Both RNA are of same length!'
assert length_rna == length_new_rna ,msg2
| 30.771186
| 66
| 0.590746
| 451
| 3,631
| 4.578714
| 0.181818
| 0.037772
| 0.069734
| 0.072639
| 0.824697
| 0.801453
| 0.801453
| 0.801453
| 0.798063
| 0.798063
| 0
| 0.014356
| 0.32856
| 3,631
| 118
| 67
| 30.771186
| 0.83265
| 0.069127
| 0
| 0.857143
| 0
| 0
| 0.098857
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 1
| 0.071429
| false
| 0
| 0.059524
| 0
| 0.142857
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
6d1acea6c55d41d01519b3de9caf78adc008581f
| 75
|
py
|
Python
|
almacen_api/__init__.py
|
xyla-io/almacen_api
|
07497c64e6d1d52296a20dde106bc1af36f27114
|
[
"MIT"
] | null | null | null |
almacen_api/__init__.py
|
xyla-io/almacen_api
|
07497c64e6d1d52296a20dde106bc1af36f27114
|
[
"MIT"
] | null | null | null |
almacen_api/__init__.py
|
xyla-io/almacen_api
|
07497c64e6d1d52296a20dde106bc1af36f27114
|
[
"MIT"
] | null | null | null |
from almacen_api.api import AlmacenAPI, api
from almacen_api.app import app
| 37.5
| 43
| 0.853333
| 13
| 75
| 4.769231
| 0.461538
| 0.354839
| 0.451613
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.106667
| 75
| 2
| 44
| 37.5
| 0.925373
| 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
| 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
| 7
|
6d446eb63bb01f5af329d4b6422c7feea4daca19
| 106,288
|
py
|
Python
|
nova/tests/unit/scheduler/test_host_manager.py
|
bopopescu/nova-token
|
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
|
[
"Apache-2.0"
] | null | null | null |
nova/tests/unit/scheduler/test_host_manager.py
|
bopopescu/nova-token
|
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
|
[
"Apache-2.0"
] | null | null | null |
nova/tests/unit/scheduler/test_host_manager.py
|
bopopescu/nova-token
|
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
|
[
"Apache-2.0"
] | 2
|
2017-07-20T17:31:34.000Z
|
2020-07-24T02:42:19.000Z
|
begin_unit
comment|'# Copyright (c) 2011 OpenStack Foundation'
nl|'\n'
comment|'# All Rights Reserved.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# http://www.apache.org/licenses/LICENSE-2.0'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Unless required by applicable law or agreed to in writing, software'
nl|'\n'
comment|'# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT'
nl|'\n'
comment|'# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the'
nl|'\n'
comment|'# License for the specific language governing permissions and limitations'
nl|'\n'
comment|'# under the License.'
nl|'\n'
string|'"""\nTests For HostManager\n"""'
newline|'\n'
nl|'\n'
name|'import'
name|'collections'
newline|'\n'
name|'import'
name|'datetime'
newline|'\n'
nl|'\n'
name|'import'
name|'mock'
newline|'\n'
name|'from'
name|'oslo_serialization'
name|'import'
name|'jsonutils'
newline|'\n'
name|'from'
name|'oslo_utils'
name|'import'
name|'versionutils'
newline|'\n'
name|'import'
name|'six'
newline|'\n'
nl|'\n'
name|'import'
name|'nova'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'compute'
name|'import'
name|'task_states'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'compute'
name|'import'
name|'vm_states'
newline|'\n'
name|'import'
name|'nova'
op|'.'
name|'conf'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'exception'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'objects'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'objects'
name|'import'
name|'base'
name|'as'
name|'obj_base'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'pci'
name|'import'
name|'stats'
name|'as'
name|'pci_stats'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'scheduler'
name|'import'
name|'filters'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'scheduler'
name|'import'
name|'host_manager'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'test'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
name|'import'
name|'fixtures'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
name|'import'
name|'fake_instance'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
name|'import'
name|'matchers'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
op|'.'
name|'scheduler'
name|'import'
name|'fakes'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
name|'import'
name|'uuidsentinel'
name|'as'
name|'uuids'
newline|'\n'
nl|'\n'
DECL|variable|CONF
name|'CONF'
op|'='
name|'nova'
op|'.'
name|'conf'
op|'.'
name|'CONF'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|FakeFilterClass1
name|'class'
name|'FakeFilterClass1'
op|'('
name|'filters'
op|'.'
name|'BaseHostFilter'
op|')'
op|':'
newline|'\n'
DECL|member|host_passes
indent|' '
name|'def'
name|'host_passes'
op|'('
name|'self'
op|','
name|'host_state'
op|','
name|'filter_properties'
op|')'
op|':'
newline|'\n'
indent|' '
name|'pass'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|FakeFilterClass2
dedent|''
dedent|''
name|'class'
name|'FakeFilterClass2'
op|'('
name|'filters'
op|'.'
name|'BaseHostFilter'
op|')'
op|':'
newline|'\n'
DECL|member|host_passes
indent|' '
name|'def'
name|'host_passes'
op|'('
name|'self'
op|','
name|'host_state'
op|','
name|'filter_properties'
op|')'
op|':'
newline|'\n'
indent|' '
name|'pass'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|HostManagerTestCase
dedent|''
dedent|''
name|'class'
name|'HostManagerTestCase'
op|'('
name|'test'
op|'.'
name|'NoDBTestCase'
op|')'
op|':'
newline|'\n'
indent|' '
string|'"""Test case for HostManager class."""'
newline|'\n'
nl|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host_manager'
op|'.'
name|'HostManager'
op|','
string|"'_init_instance_info'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host_manager'
op|'.'
name|'HostManager'
op|','
string|"'_init_aggregates'"
op|')'
newline|'\n'
DECL|member|setUp
name|'def'
name|'setUp'
op|'('
name|'self'
op|','
name|'mock_init_agg'
op|','
name|'mock_init_inst'
op|')'
op|':'
newline|'\n'
indent|' '
name|'super'
op|'('
name|'HostManagerTestCase'
op|','
name|'self'
op|')'
op|'.'
name|'setUp'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'flags'
op|'('
name|'scheduler_available_filters'
op|'='
op|'['
string|"'%s.%s'"
op|'%'
op|'('
name|'__name__'
op|','
name|'cls'
op|')'
name|'for'
nl|'\n'
name|'cls'
name|'in'
op|'['
string|"'FakeFilterClass1'"
op|','
nl|'\n'
string|"'FakeFilterClass2'"
op|']'
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'flags'
op|'('
name|'scheduler_default_filters'
op|'='
op|'['
string|"'FakeFilterClass1'"
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'='
name|'host_manager'
op|'.'
name|'HostManager'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'fake_hosts'
op|'='
op|'['
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|"'fake_host%s'"
op|'%'
name|'x'
op|','
nl|'\n'
string|"'fake-node'"
op|')'
name|'for'
name|'x'
name|'in'
name|'range'
op|'('
number|'1'
op|','
number|'5'
op|')'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'fake_hosts'
op|'+='
op|'['
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|"'fake_multihost'"
op|','
nl|'\n'
string|"'fake-node%s'"
op|'%'
name|'x'
op|')'
name|'for'
name|'x'
name|'in'
name|'range'
op|'('
number|'1'
op|','
number|'5'
op|')'
op|']'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'useFixture'
op|'('
name|'fixtures'
op|'.'
name|'SpawnIsSynchronousFixture'
op|'('
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_load_filters
dedent|''
name|'def'
name|'test_load_filters'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'filters'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_load_filters'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'filters'
op|','
op|'['
string|"'FakeFilterClass1'"
op|']'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'nova'
op|'.'
name|'objects'
op|'.'
name|'InstanceList'
op|','
string|"'get_by_filters'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'nova'
op|'.'
name|'objects'
op|'.'
name|'ComputeNodeList'
op|','
string|"'get_all'"
op|')'
newline|'\n'
DECL|member|test_init_instance_info_batches
name|'def'
name|'test_init_instance_info_batches'
op|'('
name|'self'
op|','
name|'mock_get_all'
op|','
nl|'\n'
name|'mock_get_by_filters'
op|')'
op|':'
newline|'\n'
indent|' '
name|'cn_list'
op|'='
name|'objects'
op|'.'
name|'ComputeNodeList'
op|'('
op|')'
newline|'\n'
name|'for'
name|'num'
name|'in'
name|'range'
op|'('
number|'22'
op|')'
op|':'
newline|'\n'
indent|' '
name|'host_name'
op|'='
string|"'host_%s'"
op|'%'
name|'num'
newline|'\n'
name|'cn_list'
op|'.'
name|'objects'
op|'.'
name|'append'
op|'('
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
name|'host'
op|'='
name|'host_name'
op|')'
op|')'
newline|'\n'
dedent|''
name|'mock_get_all'
op|'.'
name|'return_value'
op|'='
name|'cn_list'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_init_instance_info'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'mock_get_by_filters'
op|'.'
name|'call_count'
op|','
number|'3'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'nova'
op|'.'
name|'objects'
op|'.'
name|'InstanceList'
op|','
string|"'get_by_filters'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'nova'
op|'.'
name|'objects'
op|'.'
name|'ComputeNodeList'
op|','
string|"'get_all'"
op|')'
newline|'\n'
DECL|member|test_init_instance_info
name|'def'
name|'test_init_instance_info'
op|'('
name|'self'
op|','
name|'mock_get_all'
op|','
nl|'\n'
name|'mock_get_by_filters'
op|')'
op|':'
newline|'\n'
indent|' '
name|'cn1'
op|'='
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
name|'host'
op|'='
string|"'host1'"
op|')'
newline|'\n'
name|'cn2'
op|'='
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
name|'host'
op|'='
string|"'host2'"
op|')'
newline|'\n'
name|'inst1'
op|'='
name|'objects'
op|'.'
name|'Instance'
op|'('
name|'host'
op|'='
string|"'host1'"
op|','
name|'uuid'
op|'='
string|"'uuid1'"
op|')'
newline|'\n'
name|'inst2'
op|'='
name|'objects'
op|'.'
name|'Instance'
op|'('
name|'host'
op|'='
string|"'host1'"
op|','
name|'uuid'
op|'='
string|"'uuid2'"
op|')'
newline|'\n'
name|'inst3'
op|'='
name|'objects'
op|'.'
name|'Instance'
op|'('
name|'host'
op|'='
string|"'host2'"
op|','
name|'uuid'
op|'='
string|"'uuid3'"
op|')'
newline|'\n'
name|'mock_get_all'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'ComputeNodeList'
op|'('
name|'objects'
op|'='
op|'['
name|'cn1'
op|','
name|'cn2'
op|']'
op|')'
newline|'\n'
name|'mock_get_by_filters'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
nl|'\n'
name|'objects'
op|'='
op|'['
name|'inst1'
op|','
name|'inst2'
op|','
name|'inst3'
op|']'
op|')'
newline|'\n'
name|'hm'
op|'='
name|'self'
op|'.'
name|'host_manager'
newline|'\n'
name|'hm'
op|'.'
name|'_instance_info'
op|'='
op|'{'
op|'}'
newline|'\n'
name|'hm'
op|'.'
name|'_init_instance_info'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'hm'
op|'.'
name|'_instance_info'
op|')'
op|','
number|'2'
op|')'
newline|'\n'
name|'fake_info'
op|'='
name|'hm'
op|'.'
name|'_instance_info'
op|'['
string|"'host1'"
op|']'
newline|'\n'
name|'self'
op|'.'
name|'assertIn'
op|'('
string|"'uuid1'"
op|','
name|'fake_info'
op|'['
string|"'instances'"
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertIn'
op|'('
string|"'uuid2'"
op|','
name|'fake_info'
op|'['
string|"'instances'"
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertNotIn'
op|'('
string|"'uuid3'"
op|','
name|'fake_info'
op|'['
string|"'instances'"
op|']'
op|')'
newline|'\n'
name|'exp_filters'
op|'='
op|'{'
string|"'deleted'"
op|':'
name|'False'
op|','
string|"'host'"
op|':'
op|'['
string|"u'host1'"
op|','
string|"u'host2'"
op|']'
op|'}'
newline|'\n'
name|'mock_get_by_filters'
op|'.'
name|'assert_called_once_with'
op|'('
name|'mock'
op|'.'
name|'ANY'
op|','
name|'exp_filters'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_default_filters
dedent|''
name|'def'
name|'test_default_filters'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'default_filters'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'default_filters'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'1'
op|','
name|'len'
op|'('
name|'default_filters'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertIsInstance'
op|'('
name|'default_filters'
op|'['
number|'0'
op|']'
op|','
name|'FakeFilterClass1'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host_manager'
op|'.'
name|'HostManager'
op|','
string|"'_init_instance_info'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'objects'
op|'.'
name|'AggregateList'
op|','
string|"'get_all'"
op|')'
newline|'\n'
DECL|member|test_init_aggregates_no_aggs
name|'def'
name|'test_init_aggregates_no_aggs'
op|'('
name|'self'
op|','
name|'agg_get_all'
op|','
name|'mock_init_info'
op|')'
op|':'
newline|'\n'
indent|' '
name|'agg_get_all'
op|'.'
name|'return_value'
op|'='
op|'['
op|']'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'='
name|'host_manager'
op|'.'
name|'HostManager'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
op|'}'
op|','
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'aggs_by_id'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
op|'}'
op|','
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host_manager'
op|'.'
name|'HostManager'
op|','
string|"'_init_instance_info'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'objects'
op|'.'
name|'AggregateList'
op|','
string|"'get_all'"
op|')'
newline|'\n'
DECL|member|test_init_aggregates_one_agg_no_hosts
name|'def'
name|'test_init_aggregates_one_agg_no_hosts'
op|'('
name|'self'
op|','
name|'agg_get_all'
op|','
nl|'\n'
name|'mock_init_info'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_agg'
op|'='
name|'objects'
op|'.'
name|'Aggregate'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'hosts'
op|'='
op|'['
op|']'
op|')'
newline|'\n'
name|'agg_get_all'
op|'.'
name|'return_value'
op|'='
op|'['
name|'fake_agg'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'='
name|'host_manager'
op|'.'
name|'HostManager'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
number|'1'
op|':'
name|'fake_agg'
op|'}'
op|','
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'aggs_by_id'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
op|'}'
op|','
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host_manager'
op|'.'
name|'HostManager'
op|','
string|"'_init_instance_info'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'objects'
op|'.'
name|'AggregateList'
op|','
string|"'get_all'"
op|')'
newline|'\n'
DECL|member|test_init_aggregates_one_agg_with_hosts
name|'def'
name|'test_init_aggregates_one_agg_with_hosts'
op|'('
name|'self'
op|','
name|'agg_get_all'
op|','
nl|'\n'
name|'mock_init_info'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_agg'
op|'='
name|'objects'
op|'.'
name|'Aggregate'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'hosts'
op|'='
op|'['
string|"'fake-host'"
op|']'
op|')'
newline|'\n'
name|'agg_get_all'
op|'.'
name|'return_value'
op|'='
op|'['
name|'fake_agg'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'='
name|'host_manager'
op|'.'
name|'HostManager'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
number|'1'
op|':'
name|'fake_agg'
op|'}'
op|','
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'aggs_by_id'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
string|"'fake-host'"
op|':'
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|'}'
op|','
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_update_aggregates
dedent|''
name|'def'
name|'test_update_aggregates'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_agg'
op|'='
name|'objects'
op|'.'
name|'Aggregate'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'hosts'
op|'='
op|'['
string|"'fake-host'"
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'update_aggregates'
op|'('
op|'['
name|'fake_agg'
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
number|'1'
op|':'
name|'fake_agg'
op|'}'
op|','
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'aggs_by_id'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
string|"'fake-host'"
op|':'
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|'}'
op|','
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_update_aggregates_remove_hosts
dedent|''
name|'def'
name|'test_update_aggregates_remove_hosts'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_agg'
op|'='
name|'objects'
op|'.'
name|'Aggregate'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'hosts'
op|'='
op|'['
string|"'fake-host'"
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'update_aggregates'
op|'('
op|'['
name|'fake_agg'
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
number|'1'
op|':'
name|'fake_agg'
op|'}'
op|','
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'aggs_by_id'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
string|"'fake-host'"
op|':'
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|'}'
op|','
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|')'
newline|'\n'
comment|"# Let's remove the host from the aggregate and update again"
nl|'\n'
name|'fake_agg'
op|'.'
name|'hosts'
op|'='
op|'['
op|']'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'update_aggregates'
op|'('
op|'['
name|'fake_agg'
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
number|'1'
op|':'
name|'fake_agg'
op|'}'
op|','
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'aggs_by_id'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
string|"'fake-host'"
op|':'
name|'set'
op|'('
op|'['
op|']'
op|')'
op|'}'
op|','
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_delete_aggregate
dedent|''
name|'def'
name|'test_delete_aggregate'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_agg'
op|'='
name|'objects'
op|'.'
name|'Aggregate'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'hosts'
op|'='
op|'['
string|"'fake-host'"
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|'='
name|'collections'
op|'.'
name|'defaultdict'
op|'('
nl|'\n'
name|'set'
op|','
op|'{'
string|"'fake-host'"
op|':'
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'aggs_by_id'
op|'='
op|'{'
number|'1'
op|':'
name|'fake_agg'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'delete_aggregate'
op|'('
name|'fake_agg'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
op|'}'
op|','
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'aggs_by_id'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
string|"'fake-host'"
op|':'
name|'set'
op|'('
op|'['
op|']'
op|')'
op|'}'
op|','
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_choose_host_filters_not_found
dedent|''
name|'def'
name|'test_choose_host_filters_not_found'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'self'
op|'.'
name|'assertRaises'
op|'('
name|'exception'
op|'.'
name|'SchedulerHostFilterNotFound'
op|','
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_choose_host_filters'
op|','
nl|'\n'
string|"'FakeFilterClass3'"
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_choose_host_filters
dedent|''
name|'def'
name|'test_choose_host_filters'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
comment|'# Test we return 1 correct filter object'
nl|'\n'
indent|' '
name|'host_filters'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_choose_host_filters'
op|'('
nl|'\n'
op|'['
string|"'FakeFilterClass2'"
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'1'
op|','
name|'len'
op|'('
name|'host_filters'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertIsInstance'
op|'('
name|'host_filters'
op|'['
number|'0'
op|']'
op|','
name|'FakeFilterClass2'
op|')'
newline|'\n'
nl|'\n'
DECL|member|_mock_get_filtered_hosts
dedent|''
name|'def'
name|'_mock_get_filtered_hosts'
op|'('
name|'self'
op|','
name|'info'
op|')'
op|':'
newline|'\n'
indent|' '
name|'info'
op|'['
string|"'got_objs'"
op|']'
op|'='
op|'['
op|']'
newline|'\n'
name|'info'
op|'['
string|"'got_fprops'"
op|']'
op|'='
op|'['
op|']'
newline|'\n'
nl|'\n'
DECL|function|fake_filter_one
name|'def'
name|'fake_filter_one'
op|'('
name|'_self'
op|','
name|'obj'
op|','
name|'filter_props'
op|')'
op|':'
newline|'\n'
indent|' '
name|'info'
op|'['
string|"'got_objs'"
op|']'
op|'.'
name|'append'
op|'('
name|'obj'
op|')'
newline|'\n'
name|'info'
op|'['
string|"'got_fprops'"
op|']'
op|'.'
name|'append'
op|'('
name|'filter_props'
op|')'
newline|'\n'
name|'return'
name|'True'
newline|'\n'
nl|'\n'
dedent|''
name|'self'
op|'.'
name|'stub_out'
op|'('
name|'__name__'
op|'+'
string|"'.FakeFilterClass1._filter_one'"
op|','
nl|'\n'
name|'fake_filter_one'
op|')'
newline|'\n'
nl|'\n'
DECL|member|_verify_result
dedent|''
name|'def'
name|'_verify_result'
op|'('
name|'self'
op|','
name|'info'
op|','
name|'result'
op|','
name|'filters'
op|'='
name|'True'
op|')'
op|':'
newline|'\n'
indent|' '
name|'for'
name|'x'
name|'in'
name|'info'
op|'['
string|"'got_fprops'"
op|']'
op|':'
newline|'\n'
indent|' '
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'x'
op|','
name|'info'
op|'['
string|"'expected_fprops'"
op|']'
op|')'
newline|'\n'
dedent|''
name|'if'
name|'filters'
op|':'
newline|'\n'
indent|' '
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'set'
op|'('
name|'info'
op|'['
string|"'expected_objs'"
op|']'
op|')'
op|','
name|'set'
op|'('
name|'info'
op|'['
string|"'got_objs'"
op|']'
op|')'
op|')'
newline|'\n'
dedent|''
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'set'
op|'('
name|'info'
op|'['
string|"'expected_objs'"
op|']'
op|')'
op|','
name|'set'
op|'('
name|'result'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts
dedent|''
name|'def'
name|'test_get_filtered_hosts'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
name|'ignore_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
op|']'
op|')'
newline|'\n'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_ignore
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_ignore'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
string|"'fake_host1'"
op|','
string|"'fake_host3'"
op|','
nl|'\n'
string|"'fake_host5'"
op|','
string|"'fake_multihost'"
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
op|']'
op|')'
newline|'\n'
nl|'\n'
comment|'# [1] and [3] are host2 and host4'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'1'
op|']'
op|','
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'3'
op|']'
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_ignore_case_insensitive
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_ignore_case_insensitive'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuids'
op|'='
name|'uuids'
op|'.'
name|'fakehost'
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
string|"'FAKE_HOST1'"
op|','
string|"'FaKe_HoSt3'"
op|','
string|"'Fake_Multihost'"
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
op|']'
op|')'
newline|'\n'
nl|'\n'
comment|'# [1] and [3] are host2 and host4'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'1'
op|']'
op|','
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'3'
op|']'
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_force_hosts
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_force_hosts'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
string|"'fake_host1'"
op|','
string|"'fake_host3'"
op|','
string|"'fake_host5'"
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
op|']'
op|')'
newline|'\n'
nl|'\n'
comment|'# [0] and [2] are host1 and host3'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'0'
op|']'
op|','
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'2'
op|']'
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_force_case_insensitive
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_force_case_insensitive'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuids'
op|'='
name|'uuids'
op|'.'
name|'fakehost'
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
string|"'FAKE_HOST1'"
op|','
string|"'FaKe_HoSt3'"
op|','
string|"'fake_host4'"
op|','
nl|'\n'
string|"'faKe_host5'"
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
op|']'
op|')'
newline|'\n'
nl|'\n'
comment|'# [1] and [3] are host2 and host4'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'0'
op|']'
op|','
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'2'
op|']'
op|','
nl|'\n'
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'3'
op|']'
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_no_matching_force_hosts
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_no_matching_force_hosts'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
string|"'fake_host5'"
op|','
string|"'fake_host6'"
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
op|']'
op|')'
newline|'\n'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'with'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'filter_handler'
op|','
nl|'\n'
string|"'get_filtered_objects'"
op|')'
name|'as'
name|'fake_filter'
op|':'
newline|'\n'
indent|' '
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'fake_filter'
op|'.'
name|'called'
op|')'
newline|'\n'
nl|'\n'
dedent|''
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_ignore_and_force_hosts
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_ignore_and_force_hosts'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
comment|'# Ensure ignore_hosts processed before force_hosts in host filters.'
nl|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
string|"'fake_host1'"
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
string|"'fake_host3'"
op|','
string|"'fake_host1'"
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
op|']'
op|')'
newline|'\n'
nl|'\n'
comment|'# only fake_host3 should be left.'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'2'
op|']'
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_force_host_and_many_nodes
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_force_host_and_many_nodes'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
comment|'# Ensure all nodes returned for a host with many nodes'
nl|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
string|"'fake_multihost'"
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
op|']'
op|')'
newline|'\n'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'4'
op|']'
op|','
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'5'
op|']'
op|','
nl|'\n'
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'6'
op|']'
op|','
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'7'
op|']'
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_force_nodes
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_force_nodes'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
string|"'fake-node2'"
op|','
string|"'fake-node4'"
op|','
string|"'fake-node9'"
op|']'
op|')'
newline|'\n'
nl|'\n'
comment|'# [5] is fake-node2, [7] is fake-node4'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'5'
op|']'
op|','
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'7'
op|']'
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_force_hosts_and_nodes
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_force_hosts_and_nodes'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
comment|'# Ensure only overlapping results if both force host and node'
nl|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
string|"'fake-host1'"
op|','
string|"'fake_multihost'"
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
string|"'fake-node2'"
op|','
string|"'fake-node9'"
op|']'
op|')'
newline|'\n'
nl|'\n'
comment|'# [5] is fake-node2'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'5'
op|']'
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_force_hosts_and_wrong_nodes
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_force_hosts_and_wrong_nodes'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
comment|'# Ensure non-overlapping force_node and force_host yield no result'
nl|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
string|"'fake_multihost'"
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
string|"'fake-node'"
op|']'
op|')'
newline|'\n'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_ignore_hosts_and_force_nodes
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_ignore_hosts_and_force_nodes'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
comment|'# Ensure ignore_hosts can coexist with force_nodes'
nl|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
string|"'fake_host1'"
op|','
string|"'fake_host2'"
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
string|"'fake-node4'"
op|','
string|"'fake-node2'"
op|']'
op|')'
newline|'\n'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'5'
op|']'
op|','
name|'self'
op|'.'
name|'fake_hosts'
op|'['
number|'7'
op|']'
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_get_filtered_hosts_with_ignore_hosts_and_force_same_nodes
dedent|''
name|'def'
name|'test_get_filtered_hosts_with_ignore_hosts_and_force_same_nodes'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
comment|'# Ensure ignore_hosts is processed before force_nodes'
nl|'\n'
indent|' '
name|'fake_properties'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid1'"
op|','
nl|'\n'
name|'ignore_hosts'
op|'='
op|'['
string|"'fake_multihost'"
op|']'
op|','
nl|'\n'
name|'force_hosts'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'force_nodes'
op|'='
op|'['
string|"'fake_node4'"
op|','
string|"'fake_node2'"
op|']'
op|')'
newline|'\n'
nl|'\n'
name|'info'
op|'='
op|'{'
string|"'expected_objs'"
op|':'
op|'['
op|']'
op|','
nl|'\n'
string|"'expected_fprops'"
op|':'
name|'fake_properties'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'_mock_get_filtered_hosts'
op|'('
name|'info'
op|')'
newline|'\n'
nl|'\n'
name|'result'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_filtered_hosts'
op|'('
name|'self'
op|'.'
name|'fake_hosts'
op|','
nl|'\n'
name|'fake_properties'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_verify_result'
op|'('
name|'info'
op|','
name|'result'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.scheduler.host_manager.LOG'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ServiceList.get_by_binary'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ComputeNodeList.get_all'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.InstanceList.get_by_host'"
op|')'
newline|'\n'
DECL|member|test_get_all_host_states
name|'def'
name|'test_get_all_host_states'
op|'('
name|'self'
op|','
name|'mock_get_by_host'
op|','
name|'mock_get_all'
op|','
nl|'\n'
name|'mock_get_by_binary'
op|','
name|'mock_log'
op|')'
op|':'
newline|'\n'
indent|' '
name|'mock_get_by_host'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
op|')'
newline|'\n'
name|'mock_get_all'
op|'.'
name|'return_value'
op|'='
name|'fakes'
op|'.'
name|'COMPUTE_NODES'
newline|'\n'
name|'mock_get_by_binary'
op|'.'
name|'return_value'
op|'='
name|'fakes'
op|'.'
name|'SERVICES'
newline|'\n'
name|'context'
op|'='
string|"'fake_context'"
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_all_host_states'
op|'('
name|'context'
op|')'
newline|'\n'
name|'host_states_map'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_state_map'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'host_states_map'
op|')'
op|','
number|'4'
op|')'
newline|'\n'
nl|'\n'
name|'calls'
op|'='
op|'['
nl|'\n'
name|'mock'
op|'.'
name|'call'
op|'('
nl|'\n'
string|'"Host %(hostname)s has more disk space than database "'
nl|'\n'
string|'"expected (%(physical)s GB > %(database)s GB)"'
op|','
nl|'\n'
op|'{'
string|"'physical'"
op|':'
number|'3333'
op|','
string|"'database'"
op|':'
number|'3072'
op|','
string|"'hostname'"
op|':'
string|"'node3'"
op|'}'
nl|'\n'
op|')'
op|','
nl|'\n'
name|'mock'
op|'.'
name|'call'
op|'('
nl|'\n'
string|'"No compute service record found for host %(host)s"'
op|','
nl|'\n'
op|'{'
string|"'host'"
op|':'
string|"'fake'"
op|'}'
nl|'\n'
op|')'
nl|'\n'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'calls'
op|','
name|'mock_log'
op|'.'
name|'warning'
op|'.'
name|'call_args_list'
op|')'
newline|'\n'
nl|'\n'
comment|'# Check that .service is set properly'
nl|'\n'
name|'for'
name|'i'
name|'in'
name|'range'
op|'('
number|'4'
op|')'
op|':'
newline|'\n'
indent|' '
name|'compute_node'
op|'='
name|'fakes'
op|'.'
name|'COMPUTE_NODES'
op|'['
name|'i'
op|']'
newline|'\n'
name|'host'
op|'='
name|'compute_node'
op|'.'
name|'host'
newline|'\n'
name|'node'
op|'='
name|'compute_node'
op|'.'
name|'hypervisor_hostname'
newline|'\n'
name|'state_key'
op|'='
op|'('
name|'host'
op|','
name|'node'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_states_map'
op|'['
name|'state_key'
op|']'
op|'.'
name|'service'
op|','
nl|'\n'
name|'obj_base'
op|'.'
name|'obj_to_primitive'
op|'('
name|'fakes'
op|'.'
name|'get_service_by_host'
op|'('
name|'host'
op|')'
op|')'
op|')'
newline|'\n'
nl|'\n'
dedent|''
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_states_map'
op|'['
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|')'
op|']'
op|'.'
name|'free_ram_mb'
op|','
nl|'\n'
number|'512'
op|')'
newline|'\n'
comment|'# 511GB'
nl|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_states_map'
op|'['
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|')'
op|']'
op|'.'
name|'free_disk_mb'
op|','
nl|'\n'
number|'524288'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_states_map'
op|'['
op|'('
string|"'host2'"
op|','
string|"'node2'"
op|')'
op|']'
op|'.'
name|'free_ram_mb'
op|','
nl|'\n'
number|'1024'
op|')'
newline|'\n'
comment|'# 1023GB'
nl|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_states_map'
op|'['
op|'('
string|"'host2'"
op|','
string|"'node2'"
op|')'
op|']'
op|'.'
name|'free_disk_mb'
op|','
nl|'\n'
number|'1048576'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_states_map'
op|'['
op|'('
string|"'host3'"
op|','
string|"'node3'"
op|')'
op|']'
op|'.'
name|'free_ram_mb'
op|','
nl|'\n'
number|'3072'
op|')'
newline|'\n'
comment|'# 3071GB'
nl|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_states_map'
op|'['
op|'('
string|"'host3'"
op|','
string|"'node3'"
op|')'
op|']'
op|'.'
name|'free_disk_mb'
op|','
nl|'\n'
number|'3145728'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertThat'
op|'('
nl|'\n'
name|'objects'
op|'.'
name|'NUMATopology'
op|'.'
name|'obj_from_db_obj'
op|'('
nl|'\n'
name|'host_states_map'
op|'['
op|'('
string|"'host3'"
op|','
string|"'node3'"
op|')'
op|']'
op|'.'
name|'numa_topology'
nl|'\n'
op|')'
op|'.'
name|'_to_dict'
op|'('
op|')'
op|','
nl|'\n'
name|'matchers'
op|'.'
name|'DictMatches'
op|'('
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
op|'.'
name|'_to_dict'
op|'('
op|')'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_states_map'
op|'['
op|'('
string|"'host4'"
op|','
string|"'node4'"
op|')'
op|']'
op|'.'
name|'free_ram_mb'
op|','
nl|'\n'
number|'8192'
op|')'
newline|'\n'
comment|'# 8191GB'
nl|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_states_map'
op|'['
op|'('
string|"'host4'"
op|','
string|"'node4'"
op|')'
op|']'
op|'.'
name|'free_disk_mb'
op|','
nl|'\n'
number|'8388608'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'nova'
op|'.'
name|'objects'
op|'.'
name|'InstanceList'
op|','
string|"'get_by_host'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host_manager'
op|'.'
name|'HostState'
op|','
string|"'_update_from_compute_node'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'objects'
op|'.'
name|'ComputeNodeList'
op|','
string|"'get_all'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'objects'
op|'.'
name|'ServiceList'
op|','
string|"'get_by_binary'"
op|')'
newline|'\n'
DECL|member|test_get_all_host_states_with_no_aggs
name|'def'
name|'test_get_all_host_states_with_no_aggs'
op|'('
name|'self'
op|','
name|'svc_get_by_binary'
op|','
nl|'\n'
name|'cn_get_all'
op|','
name|'update_from_cn'
op|','
nl|'\n'
name|'mock_get_by_host'
op|')'
op|':'
newline|'\n'
indent|' '
name|'svc_get_by_binary'
op|'.'
name|'return_value'
op|'='
op|'['
name|'objects'
op|'.'
name|'Service'
op|'('
name|'host'
op|'='
string|"'fake'"
op|')'
op|']'
newline|'\n'
name|'cn_get_all'
op|'.'
name|'return_value'
op|'='
op|'['
nl|'\n'
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
name|'host'
op|'='
string|"'fake'"
op|','
name|'hypervisor_hostname'
op|'='
string|"'fake'"
op|')'
op|']'
newline|'\n'
name|'mock_get_by_host'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|'='
name|'collections'
op|'.'
name|'defaultdict'
op|'('
name|'set'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_all_host_states'
op|'('
string|"'fake-context'"
op|')'
newline|'\n'
name|'host_state'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_state_map'
op|'['
op|'('
string|"'fake'"
op|','
string|"'fake'"
op|')'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'['
op|']'
op|','
name|'host_state'
op|'.'
name|'aggregates'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'nova'
op|'.'
name|'objects'
op|'.'
name|'InstanceList'
op|','
string|"'get_by_host'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host_manager'
op|'.'
name|'HostState'
op|','
string|"'_update_from_compute_node'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'objects'
op|'.'
name|'ComputeNodeList'
op|','
string|"'get_all'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'objects'
op|'.'
name|'ServiceList'
op|','
string|"'get_by_binary'"
op|')'
newline|'\n'
DECL|member|test_get_all_host_states_with_matching_aggs
name|'def'
name|'test_get_all_host_states_with_matching_aggs'
op|'('
name|'self'
op|','
name|'svc_get_by_binary'
op|','
nl|'\n'
name|'cn_get_all'
op|','
nl|'\n'
name|'update_from_cn'
op|','
nl|'\n'
name|'mock_get_by_host'
op|')'
op|':'
newline|'\n'
indent|' '
name|'svc_get_by_binary'
op|'.'
name|'return_value'
op|'='
op|'['
name|'objects'
op|'.'
name|'Service'
op|'('
name|'host'
op|'='
string|"'fake'"
op|')'
op|']'
newline|'\n'
name|'cn_get_all'
op|'.'
name|'return_value'
op|'='
op|'['
nl|'\n'
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
name|'host'
op|'='
string|"'fake'"
op|','
name|'hypervisor_hostname'
op|'='
string|"'fake'"
op|')'
op|']'
newline|'\n'
name|'mock_get_by_host'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
op|')'
newline|'\n'
name|'fake_agg'
op|'='
name|'objects'
op|'.'
name|'Aggregate'
op|'('
name|'id'
op|'='
number|'1'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|'='
name|'collections'
op|'.'
name|'defaultdict'
op|'('
nl|'\n'
name|'set'
op|','
op|'{'
string|"'fake'"
op|':'
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'aggs_by_id'
op|'='
op|'{'
number|'1'
op|':'
name|'fake_agg'
op|'}'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_all_host_states'
op|'('
string|"'fake-context'"
op|')'
newline|'\n'
name|'host_state'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_state_map'
op|'['
op|'('
string|"'fake'"
op|','
string|"'fake'"
op|')'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'['
name|'fake_agg'
op|']'
op|','
name|'host_state'
op|'.'
name|'aggregates'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'nova'
op|'.'
name|'objects'
op|'.'
name|'InstanceList'
op|','
string|"'get_by_host'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host_manager'
op|'.'
name|'HostState'
op|','
string|"'_update_from_compute_node'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'objects'
op|'.'
name|'ComputeNodeList'
op|','
string|"'get_all'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'objects'
op|'.'
name|'ServiceList'
op|','
string|"'get_by_binary'"
op|')'
newline|'\n'
DECL|member|test_get_all_host_states_with_not_matching_aggs
name|'def'
name|'test_get_all_host_states_with_not_matching_aggs'
op|'('
name|'self'
op|','
nl|'\n'
name|'svc_get_by_binary'
op|','
nl|'\n'
name|'cn_get_all'
op|','
nl|'\n'
name|'update_from_cn'
op|','
nl|'\n'
name|'mock_get_by_host'
op|')'
op|':'
newline|'\n'
indent|' '
name|'svc_get_by_binary'
op|'.'
name|'return_value'
op|'='
op|'['
name|'objects'
op|'.'
name|'Service'
op|'('
name|'host'
op|'='
string|"'fake'"
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'Service'
op|'('
name|'host'
op|'='
string|"'other'"
op|')'
op|']'
newline|'\n'
name|'cn_get_all'
op|'.'
name|'return_value'
op|'='
op|'['
nl|'\n'
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
name|'host'
op|'='
string|"'fake'"
op|','
name|'hypervisor_hostname'
op|'='
string|"'fake'"
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
name|'host'
op|'='
string|"'other'"
op|','
name|'hypervisor_hostname'
op|'='
string|"'other'"
op|')'
op|']'
newline|'\n'
name|'mock_get_by_host'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
op|')'
newline|'\n'
name|'fake_agg'
op|'='
name|'objects'
op|'.'
name|'Aggregate'
op|'('
name|'id'
op|'='
number|'1'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_aggregates_map'
op|'='
name|'collections'
op|'.'
name|'defaultdict'
op|'('
nl|'\n'
name|'set'
op|','
op|'{'
string|"'other'"
op|':'
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'aggs_by_id'
op|'='
op|'{'
number|'1'
op|':'
name|'fake_agg'
op|'}'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_all_host_states'
op|'('
string|"'fake-context'"
op|')'
newline|'\n'
name|'host_state'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_state_map'
op|'['
op|'('
string|"'fake'"
op|','
string|"'fake'"
op|')'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'['
op|']'
op|','
name|'host_state'
op|'.'
name|'aggregates'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ServiceList.get_by_binary'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ComputeNodeList.get_all'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.InstanceList.get_by_host'"
op|')'
newline|'\n'
DECL|member|test_get_all_host_states_updated
name|'def'
name|'test_get_all_host_states_updated'
op|'('
name|'self'
op|','
name|'mock_get_by_host'
op|','
nl|'\n'
name|'mock_get_all_comp'
op|','
nl|'\n'
name|'mock_get_svc_by_binary'
op|')'
op|':'
newline|'\n'
indent|' '
name|'mock_get_all_comp'
op|'.'
name|'return_value'
op|'='
name|'fakes'
op|'.'
name|'COMPUTE_NODES'
newline|'\n'
name|'mock_get_svc_by_binary'
op|'.'
name|'return_value'
op|'='
name|'fakes'
op|'.'
name|'SERVICES'
newline|'\n'
name|'context'
op|'='
string|"'fake_context'"
newline|'\n'
name|'hm'
op|'='
name|'self'
op|'.'
name|'host_manager'
newline|'\n'
name|'inst1'
op|'='
name|'objects'
op|'.'
name|'Instance'
op|'('
name|'uuid'
op|'='
string|"'uuid1'"
op|')'
newline|'\n'
name|'cn1'
op|'='
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
name|'host'
op|'='
string|"'host1'"
op|')'
newline|'\n'
name|'hm'
op|'.'
name|'_instance_info'
op|'='
op|'{'
string|"'host1'"
op|':'
op|'{'
string|"'instances'"
op|':'
op|'{'
string|"'uuid1'"
op|':'
name|'inst1'
op|'}'
op|','
nl|'\n'
string|"'updated'"
op|':'
name|'True'
op|'}'
op|'}'
newline|'\n'
name|'host_state'
op|'='
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|"'host1'"
op|','
name|'cn1'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'host_state'
op|'.'
name|'instances'
op|')'
newline|'\n'
name|'mock_get_by_host'
op|'.'
name|'return_value'
op|'='
name|'None'
newline|'\n'
name|'host_state'
op|'.'
name|'update'
op|'('
nl|'\n'
name|'inst_dict'
op|'='
name|'hm'
op|'.'
name|'_get_instance_info'
op|'('
name|'context'
op|','
name|'cn1'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'mock_get_by_host'
op|'.'
name|'called'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'host_state'
op|'.'
name|'instances'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_state'
op|'.'
name|'instances'
op|'['
string|"'uuid1'"
op|']'
op|','
name|'inst1'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ServiceList.get_by_binary'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ComputeNodeList.get_all'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.InstanceList.get_by_host'"
op|')'
newline|'\n'
DECL|member|test_get_all_host_states_not_updated
name|'def'
name|'test_get_all_host_states_not_updated'
op|'('
name|'self'
op|','
name|'mock_get_by_host'
op|','
nl|'\n'
name|'mock_get_all_comp'
op|','
nl|'\n'
name|'mock_get_svc_by_binary'
op|')'
op|':'
newline|'\n'
indent|' '
name|'mock_get_all_comp'
op|'.'
name|'return_value'
op|'='
name|'fakes'
op|'.'
name|'COMPUTE_NODES'
newline|'\n'
name|'mock_get_svc_by_binary'
op|'.'
name|'return_value'
op|'='
name|'fakes'
op|'.'
name|'SERVICES'
newline|'\n'
name|'context'
op|'='
string|"'fake_context'"
newline|'\n'
name|'hm'
op|'='
name|'self'
op|'.'
name|'host_manager'
newline|'\n'
name|'inst1'
op|'='
name|'objects'
op|'.'
name|'Instance'
op|'('
name|'uuid'
op|'='
string|"'uuid1'"
op|')'
newline|'\n'
name|'cn1'
op|'='
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
name|'host'
op|'='
string|"'host1'"
op|')'
newline|'\n'
name|'hm'
op|'.'
name|'_instance_info'
op|'='
op|'{'
string|"'host1'"
op|':'
op|'{'
string|"'instances'"
op|':'
op|'{'
string|"'uuid1'"
op|':'
name|'inst1'
op|'}'
op|','
nl|'\n'
string|"'updated'"
op|':'
name|'False'
op|'}'
op|'}'
newline|'\n'
name|'host_state'
op|'='
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|"'host1'"
op|','
name|'cn1'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'host_state'
op|'.'
name|'instances'
op|')'
newline|'\n'
name|'mock_get_by_host'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
name|'objects'
op|'='
op|'['
name|'inst1'
op|']'
op|')'
newline|'\n'
name|'host_state'
op|'.'
name|'update'
op|'('
nl|'\n'
name|'inst_dict'
op|'='
name|'hm'
op|'.'
name|'_get_instance_info'
op|'('
name|'context'
op|','
name|'cn1'
op|')'
op|')'
newline|'\n'
name|'mock_get_by_host'
op|'.'
name|'assert_called_once_with'
op|'('
name|'context'
op|','
name|'cn1'
op|'.'
name|'host'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'host_state'
op|'.'
name|'instances'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'host_state'
op|'.'
name|'instances'
op|'['
string|"'uuid1'"
op|']'
op|','
name|'inst1'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.InstanceList.get_by_host'"
op|')'
newline|'\n'
DECL|member|test_recreate_instance_info
name|'def'
name|'test_recreate_instance_info'
op|'('
name|'self'
op|','
name|'mock_get_by_host'
op|')'
op|':'
newline|'\n'
indent|' '
name|'host_name'
op|'='
string|"'fake_host'"
newline|'\n'
name|'inst1'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'aaa'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'inst2'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'bbb'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'orig_inst_dict'
op|'='
op|'{'
name|'inst1'
op|'.'
name|'uuid'
op|':'
name|'inst1'
op|','
name|'inst2'
op|'.'
name|'uuid'
op|':'
name|'inst2'
op|'}'
newline|'\n'
name|'new_inst_list'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
name|'objects'
op|'='
op|'['
name|'inst1'
op|','
name|'inst2'
op|']'
op|')'
newline|'\n'
name|'mock_get_by_host'
op|'.'
name|'return_value'
op|'='
name|'new_inst_list'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'='
op|'{'
nl|'\n'
name|'host_name'
op|':'
op|'{'
nl|'\n'
string|"'instances'"
op|':'
name|'orig_inst_dict'
op|','
nl|'\n'
string|"'updated'"
op|':'
name|'True'
op|','
nl|'\n'
op|'}'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_recreate_instance_info'
op|'('
string|"'fake_context'"
op|','
name|'host_name'
op|')'
newline|'\n'
name|'new_info'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'['
name|'host_name'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'new_info'
op|'['
string|"'instances'"
op|']'
op|')'
op|','
name|'len'
op|'('
name|'new_inst_list'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'new_info'
op|'['
string|"'updated'"
op|']'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_update_instance_info
dedent|''
name|'def'
name|'test_update_instance_info'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'host_name'
op|'='
string|"'fake_host'"
newline|'\n'
name|'inst1'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'aaa'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'inst2'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'bbb'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'orig_inst_dict'
op|'='
op|'{'
name|'inst1'
op|'.'
name|'uuid'
op|':'
name|'inst1'
op|','
name|'inst2'
op|'.'
name|'uuid'
op|':'
name|'inst2'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'='
op|'{'
nl|'\n'
name|'host_name'
op|':'
op|'{'
nl|'\n'
string|"'instances'"
op|':'
name|'orig_inst_dict'
op|','
nl|'\n'
string|"'updated'"
op|':'
name|'False'
op|','
nl|'\n'
op|'}'
op|'}'
newline|'\n'
name|'inst3'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'ccc'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'inst4'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'ddd'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'update'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
name|'objects'
op|'='
op|'['
name|'inst3'
op|','
name|'inst4'
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'update_instance_info'
op|'('
string|"'fake_context'"
op|','
name|'host_name'
op|','
nl|'\n'
name|'update'
op|')'
newline|'\n'
name|'new_info'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'['
name|'host_name'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'new_info'
op|'['
string|"'instances'"
op|']'
op|')'
op|','
number|'4'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'new_info'
op|'['
string|"'updated'"
op|']'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_update_instance_info_unknown_host
dedent|''
name|'def'
name|'test_update_instance_info_unknown_host'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_recreate_instance_info'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'host_name'
op|'='
string|"'fake_host'"
newline|'\n'
name|'inst1'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'aaa'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'inst2'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'bbb'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'orig_inst_dict'
op|'='
op|'{'
name|'inst1'
op|'.'
name|'uuid'
op|':'
name|'inst1'
op|','
name|'inst2'
op|'.'
name|'uuid'
op|':'
name|'inst2'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'='
op|'{'
nl|'\n'
name|'host_name'
op|':'
op|'{'
nl|'\n'
string|"'instances'"
op|':'
name|'orig_inst_dict'
op|','
nl|'\n'
string|"'updated'"
op|':'
name|'False'
op|','
nl|'\n'
op|'}'
op|'}'
newline|'\n'
name|'bad_host'
op|'='
string|"'bad_host'"
newline|'\n'
name|'inst3'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'ccc'"
op|','
nl|'\n'
name|'host'
op|'='
name|'bad_host'
op|')'
newline|'\n'
name|'inst_list3'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
name|'objects'
op|'='
op|'['
name|'inst3'
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'update_instance_info'
op|'('
string|"'fake_context'"
op|','
name|'bad_host'
op|','
nl|'\n'
name|'inst_list3'
op|')'
newline|'\n'
name|'new_info'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'['
name|'host_name'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_recreate_instance_info'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
string|"'fake_context'"
op|','
name|'bad_host'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'new_info'
op|'['
string|"'instances'"
op|']'
op|')'
op|','
name|'len'
op|'('
name|'orig_inst_dict'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'new_info'
op|'['
string|"'updated'"
op|']'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_delete_instance_info
dedent|''
name|'def'
name|'test_delete_instance_info'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'host_name'
op|'='
string|"'fake_host'"
newline|'\n'
name|'inst1'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'aaa'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'inst2'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'bbb'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'orig_inst_dict'
op|'='
op|'{'
name|'inst1'
op|'.'
name|'uuid'
op|':'
name|'inst1'
op|','
name|'inst2'
op|'.'
name|'uuid'
op|':'
name|'inst2'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'='
op|'{'
nl|'\n'
name|'host_name'
op|':'
op|'{'
nl|'\n'
string|"'instances'"
op|':'
name|'orig_inst_dict'
op|','
nl|'\n'
string|"'updated'"
op|':'
name|'False'
op|','
nl|'\n'
op|'}'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'delete_instance_info'
op|'('
string|"'fake_context'"
op|','
name|'host_name'
op|','
nl|'\n'
name|'inst1'
op|'.'
name|'uuid'
op|')'
newline|'\n'
name|'new_info'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'['
name|'host_name'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'new_info'
op|'['
string|"'instances'"
op|']'
op|')'
op|','
number|'1'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'new_info'
op|'['
string|"'updated'"
op|']'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_delete_instance_info_unknown_host
dedent|''
name|'def'
name|'test_delete_instance_info_unknown_host'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_recreate_instance_info'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'host_name'
op|'='
string|"'fake_host'"
newline|'\n'
name|'inst1'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'aaa'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'inst2'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'bbb'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'orig_inst_dict'
op|'='
op|'{'
name|'inst1'
op|'.'
name|'uuid'
op|':'
name|'inst1'
op|','
name|'inst2'
op|'.'
name|'uuid'
op|':'
name|'inst2'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'='
op|'{'
nl|'\n'
name|'host_name'
op|':'
op|'{'
nl|'\n'
string|"'instances'"
op|':'
name|'orig_inst_dict'
op|','
nl|'\n'
string|"'updated'"
op|':'
name|'False'
op|','
nl|'\n'
op|'}'
op|'}'
newline|'\n'
name|'bad_host'
op|'='
string|"'bad_host'"
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'delete_instance_info'
op|'('
string|"'fake_context'"
op|','
name|'bad_host'
op|','
string|"'aaa'"
op|')'
newline|'\n'
name|'new_info'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'['
name|'host_name'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_recreate_instance_info'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
string|"'fake_context'"
op|','
name|'bad_host'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'new_info'
op|'['
string|"'instances'"
op|']'
op|')'
op|','
name|'len'
op|'('
name|'orig_inst_dict'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'new_info'
op|'['
string|"'updated'"
op|']'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_sync_instance_info
dedent|''
name|'def'
name|'test_sync_instance_info'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_recreate_instance_info'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'host_name'
op|'='
string|"'fake_host'"
newline|'\n'
name|'inst1'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'aaa'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'inst2'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'bbb'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'orig_inst_dict'
op|'='
op|'{'
name|'inst1'
op|'.'
name|'uuid'
op|':'
name|'inst1'
op|','
name|'inst2'
op|'.'
name|'uuid'
op|':'
name|'inst2'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'='
op|'{'
nl|'\n'
name|'host_name'
op|':'
op|'{'
nl|'\n'
string|"'instances'"
op|':'
name|'orig_inst_dict'
op|','
nl|'\n'
string|"'updated'"
op|':'
name|'False'
op|','
nl|'\n'
op|'}'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'sync_instance_info'
op|'('
string|"'fake_context'"
op|','
name|'host_name'
op|','
nl|'\n'
op|'['
string|"'bbb'"
op|','
string|"'aaa'"
op|']'
op|')'
newline|'\n'
name|'new_info'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'['
name|'host_name'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_recreate_instance_info'
op|'.'
name|'called'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'new_info'
op|'['
string|"'updated'"
op|']'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_sync_instance_info_fail
dedent|''
name|'def'
name|'test_sync_instance_info_fail'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_recreate_instance_info'
op|'='
name|'mock'
op|'.'
name|'MagicMock'
op|'('
op|')'
newline|'\n'
name|'host_name'
op|'='
string|"'fake_host'"
newline|'\n'
name|'inst1'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'aaa'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'inst2'
op|'='
name|'fake_instance'
op|'.'
name|'fake_instance_obj'
op|'('
string|"'fake_context'"
op|','
name|'uuid'
op|'='
string|"'bbb'"
op|','
nl|'\n'
name|'host'
op|'='
name|'host_name'
op|')'
newline|'\n'
name|'orig_inst_dict'
op|'='
op|'{'
name|'inst1'
op|'.'
name|'uuid'
op|':'
name|'inst1'
op|','
name|'inst2'
op|'.'
name|'uuid'
op|':'
name|'inst2'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'='
op|'{'
nl|'\n'
name|'host_name'
op|':'
op|'{'
nl|'\n'
string|"'instances'"
op|':'
name|'orig_inst_dict'
op|','
nl|'\n'
string|"'updated'"
op|':'
name|'False'
op|','
nl|'\n'
op|'}'
op|'}'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'sync_instance_info'
op|'('
string|"'fake_context'"
op|','
name|'host_name'
op|','
nl|'\n'
op|'['
string|"'bbb'"
op|','
string|"'aaa'"
op|','
string|"'new'"
op|']'
op|')'
newline|'\n'
name|'new_info'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_instance_info'
op|'['
name|'host_name'
op|']'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'_recreate_instance_info'
op|'.'
name|'assert_called_once_with'
op|'('
nl|'\n'
string|"'fake_context'"
op|','
name|'host_name'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'new_info'
op|'['
string|"'updated'"
op|']'
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|HostManagerChangedNodesTestCase
dedent|''
dedent|''
name|'class'
name|'HostManagerChangedNodesTestCase'
op|'('
name|'test'
op|'.'
name|'NoDBTestCase'
op|')'
op|':'
newline|'\n'
indent|' '
string|'"""Test case for HostManager class."""'
newline|'\n'
nl|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host_manager'
op|'.'
name|'HostManager'
op|','
string|"'_init_instance_info'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host_manager'
op|'.'
name|'HostManager'
op|','
string|"'_init_aggregates'"
op|')'
newline|'\n'
DECL|member|setUp
name|'def'
name|'setUp'
op|'('
name|'self'
op|','
name|'mock_init_agg'
op|','
name|'mock_init_inst'
op|')'
op|':'
newline|'\n'
indent|' '
name|'super'
op|'('
name|'HostManagerChangedNodesTestCase'
op|','
name|'self'
op|')'
op|'.'
name|'setUp'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'='
name|'host_manager'
op|'.'
name|'HostManager'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'fake_hosts'
op|'='
op|'['
nl|'\n'
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|')'
op|','
nl|'\n'
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|"'host2'"
op|','
string|"'node2'"
op|')'
op|','
nl|'\n'
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|"'host3'"
op|','
string|"'node3'"
op|')'
op|','
nl|'\n'
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|"'host4'"
op|','
string|"'node4'"
op|')'
nl|'\n'
op|']'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ServiceList.get_by_binary'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ComputeNodeList.get_all'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.InstanceList.get_by_host'"
op|')'
newline|'\n'
DECL|member|test_get_all_host_states
name|'def'
name|'test_get_all_host_states'
op|'('
name|'self'
op|','
name|'mock_get_by_host'
op|','
name|'mock_get_all'
op|','
nl|'\n'
name|'mock_get_by_binary'
op|')'
op|':'
newline|'\n'
indent|' '
name|'mock_get_by_host'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
op|')'
newline|'\n'
name|'mock_get_all'
op|'.'
name|'return_value'
op|'='
name|'fakes'
op|'.'
name|'COMPUTE_NODES'
newline|'\n'
name|'mock_get_by_binary'
op|'.'
name|'return_value'
op|'='
name|'fakes'
op|'.'
name|'SERVICES'
newline|'\n'
name|'context'
op|'='
string|"'fake_context'"
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_all_host_states'
op|'('
name|'context'
op|')'
newline|'\n'
name|'host_states_map'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_state_map'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'host_states_map'
op|')'
op|','
number|'4'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ServiceList.get_by_binary'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ComputeNodeList.get_all'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.InstanceList.get_by_host'"
op|')'
newline|'\n'
DECL|member|test_get_all_host_states_after_delete_one
name|'def'
name|'test_get_all_host_states_after_delete_one'
op|'('
name|'self'
op|','
name|'mock_get_by_host'
op|','
nl|'\n'
name|'mock_get_all'
op|','
nl|'\n'
name|'mock_get_by_binary'
op|')'
op|':'
newline|'\n'
indent|' '
name|'getter'
op|'='
op|'('
name|'lambda'
name|'n'
op|':'
name|'n'
op|'.'
name|'hypervisor_hostname'
nl|'\n'
name|'if'
string|"'hypervisor_hostname'"
name|'in'
name|'n'
name|'else'
name|'None'
op|')'
newline|'\n'
name|'running_nodes'
op|'='
op|'['
name|'n'
name|'for'
name|'n'
name|'in'
name|'fakes'
op|'.'
name|'COMPUTE_NODES'
nl|'\n'
name|'if'
name|'getter'
op|'('
name|'n'
op|')'
op|'!='
string|"'node4'"
op|']'
newline|'\n'
nl|'\n'
name|'mock_get_by_host'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
op|')'
newline|'\n'
name|'mock_get_all'
op|'.'
name|'side_effect'
op|'='
op|'['
name|'fakes'
op|'.'
name|'COMPUTE_NODES'
op|','
name|'running_nodes'
op|']'
newline|'\n'
name|'mock_get_by_binary'
op|'.'
name|'side_effect'
op|'='
op|'['
name|'fakes'
op|'.'
name|'SERVICES'
op|','
name|'fakes'
op|'.'
name|'SERVICES'
op|']'
newline|'\n'
name|'context'
op|'='
string|"'fake_context'"
newline|'\n'
nl|'\n'
comment|'# first call: all nodes'
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_all_host_states'
op|'('
name|'context'
op|')'
newline|'\n'
name|'host_states_map'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_state_map'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'host_states_map'
op|')'
op|','
number|'4'
op|')'
newline|'\n'
nl|'\n'
comment|'# second call: just running nodes'
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_all_host_states'
op|'('
name|'context'
op|')'
newline|'\n'
name|'host_states_map'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_state_map'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'host_states_map'
op|')'
op|','
number|'3'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ServiceList.get_by_binary'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.ComputeNodeList.get_all'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.InstanceList.get_by_host'"
op|')'
newline|'\n'
DECL|member|test_get_all_host_states_after_delete_all
name|'def'
name|'test_get_all_host_states_after_delete_all'
op|'('
name|'self'
op|','
name|'mock_get_by_host'
op|','
nl|'\n'
name|'mock_get_all'
op|','
nl|'\n'
name|'mock_get_by_binary'
op|')'
op|':'
newline|'\n'
indent|' '
name|'mock_get_by_host'
op|'.'
name|'return_value'
op|'='
name|'objects'
op|'.'
name|'InstanceList'
op|'('
op|')'
newline|'\n'
name|'mock_get_all'
op|'.'
name|'side_effect'
op|'='
op|'['
name|'fakes'
op|'.'
name|'COMPUTE_NODES'
op|','
op|'['
op|']'
op|']'
newline|'\n'
name|'mock_get_by_binary'
op|'.'
name|'side_effect'
op|'='
op|'['
name|'fakes'
op|'.'
name|'SERVICES'
op|','
name|'fakes'
op|'.'
name|'SERVICES'
op|']'
newline|'\n'
name|'context'
op|'='
string|"'fake_context'"
newline|'\n'
nl|'\n'
comment|'# first call: all nodes'
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_all_host_states'
op|'('
name|'context'
op|')'
newline|'\n'
name|'host_states_map'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_state_map'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'host_states_map'
op|')'
op|','
number|'4'
op|')'
newline|'\n'
nl|'\n'
comment|'# second call: no nodes'
nl|'\n'
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'get_all_host_states'
op|'('
name|'context'
op|')'
newline|'\n'
name|'host_states_map'
op|'='
name|'self'
op|'.'
name|'host_manager'
op|'.'
name|'host_state_map'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'host_states_map'
op|')'
op|','
number|'0'
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|HostStateTestCase
dedent|''
dedent|''
name|'class'
name|'HostStateTestCase'
op|'('
name|'test'
op|'.'
name|'NoDBTestCase'
op|')'
op|':'
newline|'\n'
indent|' '
string|'"""Test case for HostState class."""'
newline|'\n'
nl|'\n'
comment|'# update_from_compute_node() and consume_from_request() are tested'
nl|'\n'
comment|'# in HostManagerTestCase.test_get_all_host_states()'
nl|'\n'
nl|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.utils.synchronized'"
op|','
nl|'\n'
DECL|variable|side_effect
name|'side_effect'
op|'='
name|'lambda'
name|'a'
op|':'
name|'lambda'
name|'f'
op|':'
name|'lambda'
op|'*'
name|'args'
op|':'
name|'f'
op|'('
op|'*'
name|'args'
op|')'
op|')'
newline|'\n'
DECL|member|test_stat_consumption_from_compute_node
name|'def'
name|'test_stat_consumption_from_compute_node'
op|'('
name|'self'
op|','
name|'sync_mock'
op|')'
op|':'
newline|'\n'
indent|' '
name|'stats'
op|'='
op|'{'
nl|'\n'
string|"'num_instances'"
op|':'
string|"'5'"
op|','
nl|'\n'
string|"'num_proj_12345'"
op|':'
string|"'3'"
op|','
nl|'\n'
string|"'num_proj_23456'"
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'num_vm_%s'"
op|'%'
name|'vm_states'
op|'.'
name|'BUILDING'
op|':'
string|"'2'"
op|','
nl|'\n'
string|"'num_vm_%s'"
op|'%'
name|'vm_states'
op|'.'
name|'SUSPENDED'
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'num_task_%s'"
op|'%'
name|'task_states'
op|'.'
name|'RESIZE_MIGRATING'
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'num_task_%s'"
op|'%'
name|'task_states'
op|'.'
name|'MIGRATING'
op|':'
string|"'2'"
op|','
nl|'\n'
string|"'num_os_type_linux'"
op|':'
string|"'4'"
op|','
nl|'\n'
string|"'num_os_type_windoze'"
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'io_workload'"
op|':'
string|"'42'"
op|','
nl|'\n'
op|'}'
newline|'\n'
nl|'\n'
name|'hyper_ver_int'
op|'='
name|'versionutils'
op|'.'
name|'convert_version_to_int'
op|'('
string|"'6.0.0'"
op|')'
newline|'\n'
name|'compute'
op|'='
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
nl|'\n'
name|'stats'
op|'='
name|'stats'
op|','
name|'memory_mb'
op|'='
number|'1'
op|','
name|'free_disk_gb'
op|'='
number|'0'
op|','
name|'local_gb'
op|'='
number|'0'
op|','
nl|'\n'
name|'local_gb_used'
op|'='
number|'0'
op|','
name|'free_ram_mb'
op|'='
number|'0'
op|','
name|'vcpus'
op|'='
number|'0'
op|','
name|'vcpus_used'
op|'='
number|'0'
op|','
nl|'\n'
name|'disk_available_least'
op|'='
name|'None'
op|','
nl|'\n'
name|'updated_at'
op|'='
name|'None'
op|','
name|'host_ip'
op|'='
string|"'127.0.0.1'"
op|','
nl|'\n'
name|'hypervisor_type'
op|'='
string|"'htype'"
op|','
nl|'\n'
name|'hypervisor_hostname'
op|'='
string|"'hostname'"
op|','
name|'cpu_info'
op|'='
string|"'cpu_info'"
op|','
nl|'\n'
name|'supported_hv_specs'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'hypervisor_version'
op|'='
name|'hyper_ver_int'
op|','
name|'numa_topology'
op|'='
name|'None'
op|','
nl|'\n'
name|'pci_device_pools'
op|'='
name|'None'
op|','
name|'metrics'
op|'='
name|'None'
op|','
nl|'\n'
name|'cpu_allocation_ratio'
op|'='
number|'16.0'
op|','
name|'ram_allocation_ratio'
op|'='
number|'1.5'
op|','
nl|'\n'
name|'disk_allocation_ratio'
op|'='
number|'1.0'
op|')'
newline|'\n'
nl|'\n'
name|'host'
op|'='
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|'"fakehost"'
op|','
string|'"fakenode"'
op|')'
newline|'\n'
name|'host'
op|'.'
name|'update'
op|'('
name|'compute'
op|'='
name|'compute'
op|')'
newline|'\n'
nl|'\n'
name|'sync_mock'
op|'.'
name|'assert_called_once_with'
op|'('
op|'('
string|'"fakehost"'
op|','
string|'"fakenode"'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'5'
op|','
name|'host'
op|'.'
name|'num_instances'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'42'
op|','
name|'host'
op|'.'
name|'num_io_ops'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'10'
op|','
name|'len'
op|'('
name|'host'
op|'.'
name|'stats'
op|')'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
string|"'127.0.0.1'"
op|','
name|'str'
op|'('
name|'host'
op|'.'
name|'host_ip'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
string|"'htype'"
op|','
name|'host'
op|'.'
name|'hypervisor_type'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
string|"'hostname'"
op|','
name|'host'
op|'.'
name|'hypervisor_hostname'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
string|"'cpu_info'"
op|','
name|'host'
op|'.'
name|'cpu_info'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'['
op|']'
op|','
name|'host'
op|'.'
name|'supported_instances'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'hyper_ver_int'
op|','
name|'host'
op|'.'
name|'hypervisor_version'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_stat_consumption_from_compute_node_non_pci
dedent|''
name|'def'
name|'test_stat_consumption_from_compute_node_non_pci'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'stats'
op|'='
op|'{'
nl|'\n'
string|"'num_instances'"
op|':'
string|"'5'"
op|','
nl|'\n'
string|"'num_proj_12345'"
op|':'
string|"'3'"
op|','
nl|'\n'
string|"'num_proj_23456'"
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'num_vm_%s'"
op|'%'
name|'vm_states'
op|'.'
name|'BUILDING'
op|':'
string|"'2'"
op|','
nl|'\n'
string|"'num_vm_%s'"
op|'%'
name|'vm_states'
op|'.'
name|'SUSPENDED'
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'num_task_%s'"
op|'%'
name|'task_states'
op|'.'
name|'RESIZE_MIGRATING'
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'num_task_%s'"
op|'%'
name|'task_states'
op|'.'
name|'MIGRATING'
op|':'
string|"'2'"
op|','
nl|'\n'
string|"'num_os_type_linux'"
op|':'
string|"'4'"
op|','
nl|'\n'
string|"'num_os_type_windoze'"
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'io_workload'"
op|':'
string|"'42'"
op|','
nl|'\n'
op|'}'
newline|'\n'
nl|'\n'
name|'hyper_ver_int'
op|'='
name|'versionutils'
op|'.'
name|'convert_version_to_int'
op|'('
string|"'6.0.0'"
op|')'
newline|'\n'
name|'compute'
op|'='
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
nl|'\n'
name|'stats'
op|'='
name|'stats'
op|','
name|'memory_mb'
op|'='
number|'0'
op|','
name|'free_disk_gb'
op|'='
number|'0'
op|','
name|'local_gb'
op|'='
number|'0'
op|','
nl|'\n'
name|'local_gb_used'
op|'='
number|'0'
op|','
name|'free_ram_mb'
op|'='
number|'0'
op|','
name|'vcpus'
op|'='
number|'0'
op|','
name|'vcpus_used'
op|'='
number|'0'
op|','
nl|'\n'
name|'disk_available_least'
op|'='
name|'None'
op|','
nl|'\n'
name|'updated_at'
op|'='
name|'None'
op|','
name|'host_ip'
op|'='
string|"'127.0.0.1'"
op|','
nl|'\n'
name|'hypervisor_type'
op|'='
string|"'htype'"
op|','
nl|'\n'
name|'hypervisor_hostname'
op|'='
string|"'hostname'"
op|','
name|'cpu_info'
op|'='
string|"'cpu_info'"
op|','
nl|'\n'
name|'supported_hv_specs'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'hypervisor_version'
op|'='
name|'hyper_ver_int'
op|','
name|'numa_topology'
op|'='
name|'None'
op|','
nl|'\n'
name|'pci_device_pools'
op|'='
name|'None'
op|','
name|'metrics'
op|'='
name|'None'
op|','
nl|'\n'
name|'cpu_allocation_ratio'
op|'='
number|'16.0'
op|','
name|'ram_allocation_ratio'
op|'='
number|'1.5'
op|','
nl|'\n'
name|'disk_allocation_ratio'
op|'='
number|'1.0'
op|')'
newline|'\n'
nl|'\n'
name|'host'
op|'='
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|'"fakehost"'
op|','
string|'"fakenode"'
op|')'
newline|'\n'
name|'host'
op|'.'
name|'update'
op|'('
name|'compute'
op|'='
name|'compute'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'['
op|']'
op|','
name|'host'
op|'.'
name|'pci_stats'
op|'.'
name|'pools'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'hyper_ver_int'
op|','
name|'host'
op|'.'
name|'hypervisor_version'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_stat_consumption_from_compute_node_rescue_unshelving
dedent|''
name|'def'
name|'test_stat_consumption_from_compute_node_rescue_unshelving'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'stats'
op|'='
op|'{'
nl|'\n'
string|"'num_instances'"
op|':'
string|"'5'"
op|','
nl|'\n'
string|"'num_proj_12345'"
op|':'
string|"'3'"
op|','
nl|'\n'
string|"'num_proj_23456'"
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'num_vm_%s'"
op|'%'
name|'vm_states'
op|'.'
name|'BUILDING'
op|':'
string|"'2'"
op|','
nl|'\n'
string|"'num_vm_%s'"
op|'%'
name|'vm_states'
op|'.'
name|'SUSPENDED'
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'num_task_%s'"
op|'%'
name|'task_states'
op|'.'
name|'UNSHELVING'
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'num_task_%s'"
op|'%'
name|'task_states'
op|'.'
name|'RESCUING'
op|':'
string|"'2'"
op|','
nl|'\n'
string|"'num_os_type_linux'"
op|':'
string|"'4'"
op|','
nl|'\n'
string|"'num_os_type_windoze'"
op|':'
string|"'1'"
op|','
nl|'\n'
string|"'io_workload'"
op|':'
string|"'42'"
op|','
nl|'\n'
op|'}'
newline|'\n'
nl|'\n'
name|'hyper_ver_int'
op|'='
name|'versionutils'
op|'.'
name|'convert_version_to_int'
op|'('
string|"'6.0.0'"
op|')'
newline|'\n'
name|'compute'
op|'='
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
nl|'\n'
name|'stats'
op|'='
name|'stats'
op|','
name|'memory_mb'
op|'='
number|'0'
op|','
name|'free_disk_gb'
op|'='
number|'0'
op|','
name|'local_gb'
op|'='
number|'0'
op|','
nl|'\n'
name|'local_gb_used'
op|'='
number|'0'
op|','
name|'free_ram_mb'
op|'='
number|'0'
op|','
name|'vcpus'
op|'='
number|'0'
op|','
name|'vcpus_used'
op|'='
number|'0'
op|','
nl|'\n'
name|'disk_available_least'
op|'='
name|'None'
op|','
nl|'\n'
name|'updated_at'
op|'='
name|'None'
op|','
name|'host_ip'
op|'='
string|"'127.0.0.1'"
op|','
nl|'\n'
name|'hypervisor_type'
op|'='
string|"'htype'"
op|','
nl|'\n'
name|'hypervisor_hostname'
op|'='
string|"'hostname'"
op|','
name|'cpu_info'
op|'='
string|"'cpu_info'"
op|','
nl|'\n'
name|'supported_hv_specs'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'hypervisor_version'
op|'='
name|'hyper_ver_int'
op|','
name|'numa_topology'
op|'='
name|'None'
op|','
nl|'\n'
name|'pci_device_pools'
op|'='
name|'None'
op|','
name|'metrics'
op|'='
name|'None'
op|','
nl|'\n'
name|'cpu_allocation_ratio'
op|'='
number|'16.0'
op|','
name|'ram_allocation_ratio'
op|'='
number|'1.5'
op|','
nl|'\n'
name|'disk_allocation_ratio'
op|'='
number|'1.0'
op|')'
newline|'\n'
nl|'\n'
name|'host'
op|'='
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|'"fakehost"'
op|','
string|'"fakenode"'
op|')'
newline|'\n'
name|'host'
op|'.'
name|'update'
op|'('
name|'compute'
op|'='
name|'compute'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'5'
op|','
name|'host'
op|'.'
name|'num_instances'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'42'
op|','
name|'host'
op|'.'
name|'num_io_ops'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'10'
op|','
name|'len'
op|'('
name|'host'
op|'.'
name|'stats'
op|')'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'['
op|']'
op|','
name|'host'
op|'.'
name|'pci_stats'
op|'.'
name|'pools'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'hyper_ver_int'
op|','
name|'host'
op|'.'
name|'hypervisor_version'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.utils.synchronized'"
op|','
nl|'\n'
name|'side_effect'
op|'='
name|'lambda'
name|'a'
op|':'
name|'lambda'
name|'f'
op|':'
name|'lambda'
op|'*'
name|'args'
op|':'
name|'f'
op|'('
op|'*'
name|'args'
op|')'
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.virt.hardware.get_host_numa_usage_from_instance'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.objects.Instance'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.virt.hardware.numa_fit_instance_to_host'"
op|')'
newline|'\n'
op|'@'
name|'mock'
op|'.'
name|'patch'
op|'('
string|"'nova.virt.hardware.host_topology_and_format_from_host'"
op|')'
newline|'\n'
DECL|member|test_stat_consumption_from_instance
name|'def'
name|'test_stat_consumption_from_instance'
op|'('
name|'self'
op|','
name|'host_topo_mock'
op|','
nl|'\n'
name|'numa_fit_mock'
op|','
nl|'\n'
name|'instance_init_mock'
op|','
nl|'\n'
name|'numa_usage_mock'
op|','
nl|'\n'
name|'sync_mock'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_numa_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
op|')'
op|']'
op|')'
newline|'\n'
name|'fake_host_numa_topology'
op|'='
name|'mock'
op|'.'
name|'Mock'
op|'('
op|')'
newline|'\n'
name|'fake_instance'
op|'='
name|'objects'
op|'.'
name|'Instance'
op|'('
name|'numa_topology'
op|'='
name|'fake_numa_topology'
op|')'
newline|'\n'
name|'host_topo_mock'
op|'.'
name|'return_value'
op|'='
op|'('
name|'fake_host_numa_topology'
op|','
name|'True'
op|')'
newline|'\n'
name|'numa_usage_mock'
op|'.'
name|'return_value'
op|'='
name|'fake_host_numa_topology'
newline|'\n'
name|'numa_fit_mock'
op|'.'
name|'return_value'
op|'='
name|'fake_numa_topology'
newline|'\n'
name|'instance_init_mock'
op|'.'
name|'return_value'
op|'='
name|'fake_instance'
newline|'\n'
name|'spec_obj'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid'"
op|','
nl|'\n'
name|'flavor'
op|'='
name|'objects'
op|'.'
name|'Flavor'
op|'('
name|'root_gb'
op|'='
number|'0'
op|','
name|'ephemeral_gb'
op|'='
number|'0'
op|','
name|'memory_mb'
op|'='
number|'0'
op|','
nl|'\n'
name|'vcpus'
op|'='
number|'0'
op|')'
op|','
nl|'\n'
name|'numa_topology'
op|'='
name|'fake_numa_topology'
op|','
nl|'\n'
name|'pci_requests'
op|'='
name|'objects'
op|'.'
name|'InstancePCIRequests'
op|'('
name|'requests'
op|'='
op|'['
op|']'
op|')'
op|')'
newline|'\n'
name|'host'
op|'='
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|'"fakehost"'
op|','
string|'"fakenode"'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertIsNone'
op|'('
name|'host'
op|'.'
name|'updated'
op|')'
newline|'\n'
name|'host'
op|'.'
name|'consume_from_request'
op|'('
name|'spec_obj'
op|')'
newline|'\n'
name|'numa_fit_mock'
op|'.'
name|'assert_called_once_with'
op|'('
name|'fake_host_numa_topology'
op|','
nl|'\n'
name|'fake_numa_topology'
op|','
nl|'\n'
name|'limits'
op|'='
name|'None'
op|','
name|'pci_requests'
op|'='
name|'None'
op|','
nl|'\n'
name|'pci_stats'
op|'='
name|'None'
op|')'
newline|'\n'
name|'numa_usage_mock'
op|'.'
name|'assert_called_once_with'
op|'('
name|'host'
op|','
name|'fake_instance'
op|')'
newline|'\n'
name|'sync_mock'
op|'.'
name|'assert_called_once_with'
op|'('
op|'('
string|'"fakehost"'
op|','
string|'"fakenode"'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'fake_host_numa_topology'
op|','
name|'host'
op|'.'
name|'numa_topology'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertIsNotNone'
op|'('
name|'host'
op|'.'
name|'updated'
op|')'
newline|'\n'
nl|'\n'
name|'second_numa_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
op|')'
op|']'
op|')'
newline|'\n'
name|'spec_obj'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid'"
op|','
nl|'\n'
name|'flavor'
op|'='
name|'objects'
op|'.'
name|'Flavor'
op|'('
name|'root_gb'
op|'='
number|'0'
op|','
name|'ephemeral_gb'
op|'='
number|'0'
op|','
name|'memory_mb'
op|'='
number|'0'
op|','
nl|'\n'
name|'vcpus'
op|'='
number|'0'
op|')'
op|','
nl|'\n'
name|'numa_topology'
op|'='
name|'second_numa_topology'
op|','
nl|'\n'
name|'pci_requests'
op|'='
name|'objects'
op|'.'
name|'InstancePCIRequests'
op|'('
name|'requests'
op|'='
op|'['
op|']'
op|')'
op|')'
newline|'\n'
name|'second_host_numa_topology'
op|'='
name|'mock'
op|'.'
name|'Mock'
op|'('
op|')'
newline|'\n'
name|'numa_usage_mock'
op|'.'
name|'return_value'
op|'='
name|'second_host_numa_topology'
newline|'\n'
name|'numa_fit_mock'
op|'.'
name|'return_value'
op|'='
name|'second_numa_topology'
newline|'\n'
nl|'\n'
name|'host'
op|'.'
name|'consume_from_request'
op|'('
name|'spec_obj'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'2'
op|','
name|'host'
op|'.'
name|'num_instances'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'2'
op|','
name|'host'
op|'.'
name|'num_io_ops'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'2'
op|','
name|'numa_usage_mock'
op|'.'
name|'call_count'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'('
op|'('
name|'host'
op|','
name|'fake_instance'
op|')'
op|','
op|')'
op|','
name|'numa_usage_mock'
op|'.'
name|'call_args'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'second_host_numa_topology'
op|','
name|'host'
op|'.'
name|'numa_topology'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertIsNotNone'
op|'('
name|'host'
op|'.'
name|'updated'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_stat_consumption_from_instance_pci
dedent|''
name|'def'
name|'test_stat_consumption_from_instance_pci'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
nl|'\n'
indent|' '
name|'inst_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
nl|'\n'
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'0'
op|']'
op|')'
op|','
nl|'\n'
name|'memory'
op|'='
number|'512'
op|','
name|'id'
op|'='
number|'0'
op|')'
op|']'
op|')'
newline|'\n'
nl|'\n'
name|'fake_requests'
op|'='
op|'['
op|'{'
string|"'request_id'"
op|':'
string|"'fake_request1'"
op|','
string|"'count'"
op|':'
number|'1'
op|','
nl|'\n'
string|"'spec'"
op|':'
op|'['
op|'{'
string|"'vendor_id'"
op|':'
string|"'8086'"
op|'}'
op|']'
op|'}'
op|']'
newline|'\n'
name|'fake_requests_obj'
op|'='
name|'objects'
op|'.'
name|'InstancePCIRequests'
op|'('
nl|'\n'
name|'requests'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstancePCIRequest'
op|'('
op|'**'
name|'r'
op|')'
nl|'\n'
name|'for'
name|'r'
name|'in'
name|'fake_requests'
op|']'
op|','
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid'"
op|')'
newline|'\n'
name|'req_spec'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid'"
op|','
nl|'\n'
name|'project_id'
op|'='
string|"'12345'"
op|','
nl|'\n'
name|'numa_topology'
op|'='
name|'inst_topology'
op|','
nl|'\n'
name|'pci_requests'
op|'='
name|'fake_requests_obj'
op|','
nl|'\n'
name|'flavor'
op|'='
name|'objects'
op|'.'
name|'Flavor'
op|'('
name|'root_gb'
op|'='
number|'0'
op|','
nl|'\n'
name|'ephemeral_gb'
op|'='
number|'0'
op|','
nl|'\n'
name|'memory_mb'
op|'='
number|'512'
op|','
nl|'\n'
name|'vcpus'
op|'='
number|'1'
op|')'
op|')'
newline|'\n'
name|'host'
op|'='
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|'"fakehost"'
op|','
string|'"fakenode"'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertIsNone'
op|'('
name|'host'
op|'.'
name|'updated'
op|')'
newline|'\n'
name|'host'
op|'.'
name|'pci_stats'
op|'='
name|'pci_stats'
op|'.'
name|'PciDeviceStats'
op|'('
nl|'\n'
op|'['
name|'objects'
op|'.'
name|'PciDevicePool'
op|'('
name|'vendor_id'
op|'='
string|"'8086'"
op|','
nl|'\n'
name|'product_id'
op|'='
string|"'15ed'"
op|','
nl|'\n'
name|'numa_node'
op|'='
number|'1'
op|','
nl|'\n'
name|'count'
op|'='
number|'1'
op|')'
op|']'
op|')'
newline|'\n'
name|'host'
op|'.'
name|'numa_topology'
op|'='
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
newline|'\n'
name|'host'
op|'.'
name|'consume_from_request'
op|'('
name|'req_spec'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertIsInstance'
op|'('
name|'req_spec'
op|'.'
name|'numa_topology'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'512'
op|','
name|'host'
op|'.'
name|'numa_topology'
op|'.'
name|'cells'
op|'['
number|'1'
op|']'
op|'.'
name|'memory_usage'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'1'
op|','
name|'host'
op|'.'
name|'numa_topology'
op|'.'
name|'cells'
op|'['
number|'1'
op|']'
op|'.'
name|'cpu_usage'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'0'
op|','
name|'len'
op|'('
name|'host'
op|'.'
name|'pci_stats'
op|'.'
name|'pools'
op|')'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertIsNotNone'
op|'('
name|'host'
op|'.'
name|'updated'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_stat_consumption_from_instance_with_pci_exception
dedent|''
name|'def'
name|'test_stat_consumption_from_instance_with_pci_exception'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'fake_requests'
op|'='
op|'['
op|'{'
string|"'request_id'"
op|':'
string|"'fake_request1'"
op|','
string|"'count'"
op|':'
number|'3'
op|','
nl|'\n'
string|"'spec'"
op|':'
op|'['
op|'{'
string|"'vendor_id'"
op|':'
string|"'8086'"
op|'}'
op|']'
op|'}'
op|']'
newline|'\n'
name|'fake_requests_obj'
op|'='
name|'objects'
op|'.'
name|'InstancePCIRequests'
op|'('
nl|'\n'
name|'requests'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstancePCIRequest'
op|'('
op|'**'
name|'r'
op|')'
nl|'\n'
name|'for'
name|'r'
name|'in'
name|'fake_requests'
op|']'
op|','
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid'"
op|')'
newline|'\n'
name|'req_spec'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
nl|'\n'
name|'instance_uuid'
op|'='
string|"'fake-uuid'"
op|','
nl|'\n'
name|'project_id'
op|'='
string|"'12345'"
op|','
nl|'\n'
name|'numa_topology'
op|'='
name|'None'
op|','
nl|'\n'
name|'pci_requests'
op|'='
name|'fake_requests_obj'
op|','
nl|'\n'
name|'flavor'
op|'='
name|'objects'
op|'.'
name|'Flavor'
op|'('
name|'root_gb'
op|'='
number|'0'
op|','
nl|'\n'
name|'ephemeral_gb'
op|'='
number|'0'
op|','
nl|'\n'
name|'memory_mb'
op|'='
number|'1024'
op|','
nl|'\n'
name|'vcpus'
op|'='
number|'1'
op|')'
op|')'
newline|'\n'
name|'host'
op|'='
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|'"fakehost"'
op|','
string|'"fakenode"'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertIsNone'
op|'('
name|'host'
op|'.'
name|'updated'
op|')'
newline|'\n'
name|'fake_updated'
op|'='
name|'mock'
op|'.'
name|'sentinel'
op|'.'
name|'fake_updated'
newline|'\n'
name|'host'
op|'.'
name|'updated'
op|'='
name|'fake_updated'
newline|'\n'
name|'host'
op|'.'
name|'pci_stats'
op|'='
name|'pci_stats'
op|'.'
name|'PciDeviceStats'
op|'('
op|')'
newline|'\n'
name|'with'
name|'mock'
op|'.'
name|'patch'
op|'.'
name|'object'
op|'('
name|'host'
op|'.'
name|'pci_stats'
op|','
string|"'apply_requests'"
op|','
nl|'\n'
name|'side_effect'
op|'='
name|'exception'
op|'.'
name|'PciDeviceRequestFailed'
op|')'
op|':'
newline|'\n'
indent|' '
name|'host'
op|'.'
name|'consume_from_request'
op|'('
name|'req_spec'
op|')'
newline|'\n'
dedent|''
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'fake_updated'
op|','
name|'host'
op|'.'
name|'updated'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_resources_consumption_from_compute_node
dedent|''
name|'def'
name|'test_resources_consumption_from_compute_node'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'_ts_now'
op|'='
name|'datetime'
op|'.'
name|'datetime'
op|'('
number|'2015'
op|','
number|'11'
op|','
number|'11'
op|','
number|'11'
op|','
number|'0'
op|','
number|'0'
op|')'
newline|'\n'
name|'metrics'
op|'='
op|'['
nl|'\n'
name|'dict'
op|'('
name|'name'
op|'='
string|"'cpu.frequency'"
op|','
nl|'\n'
name|'value'
op|'='
number|'1.0'
op|','
nl|'\n'
name|'source'
op|'='
string|"'source1'"
op|','
nl|'\n'
name|'timestamp'
op|'='
name|'_ts_now'
op|')'
op|','
nl|'\n'
name|'dict'
op|'('
name|'name'
op|'='
string|"'numa.membw.current'"
op|','
nl|'\n'
name|'numa_membw_values'
op|'='
op|'{'
string|'"0"'
op|':'
number|'10'
op|','
string|'"1"'
op|':'
number|'43'
op|'}'
op|','
nl|'\n'
name|'source'
op|'='
string|"'source2'"
op|','
nl|'\n'
name|'timestamp'
op|'='
name|'_ts_now'
op|')'
op|','
nl|'\n'
op|']'
newline|'\n'
name|'hyper_ver_int'
op|'='
name|'versionutils'
op|'.'
name|'convert_version_to_int'
op|'('
string|"'6.0.0'"
op|')'
newline|'\n'
name|'compute'
op|'='
name|'objects'
op|'.'
name|'ComputeNode'
op|'('
nl|'\n'
name|'metrics'
op|'='
name|'jsonutils'
op|'.'
name|'dumps'
op|'('
name|'metrics'
op|')'
op|','
nl|'\n'
name|'memory_mb'
op|'='
number|'0'
op|','
name|'free_disk_gb'
op|'='
number|'0'
op|','
name|'local_gb'
op|'='
number|'0'
op|','
nl|'\n'
name|'local_gb_used'
op|'='
number|'0'
op|','
name|'free_ram_mb'
op|'='
number|'0'
op|','
name|'vcpus'
op|'='
number|'0'
op|','
name|'vcpus_used'
op|'='
number|'0'
op|','
nl|'\n'
name|'disk_available_least'
op|'='
name|'None'
op|','
nl|'\n'
name|'updated_at'
op|'='
name|'None'
op|','
name|'host_ip'
op|'='
string|"'127.0.0.1'"
op|','
nl|'\n'
name|'hypervisor_type'
op|'='
string|"'htype'"
op|','
nl|'\n'
name|'hypervisor_hostname'
op|'='
string|"'hostname'"
op|','
name|'cpu_info'
op|'='
string|"'cpu_info'"
op|','
nl|'\n'
name|'supported_hv_specs'
op|'='
op|'['
op|']'
op|','
nl|'\n'
name|'hypervisor_version'
op|'='
name|'hyper_ver_int'
op|','
nl|'\n'
name|'numa_topology'
op|'='
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
op|'.'
name|'_to_json'
op|'('
op|')'
op|','
nl|'\n'
name|'stats'
op|'='
name|'None'
op|','
name|'pci_device_pools'
op|'='
name|'None'
op|','
nl|'\n'
name|'cpu_allocation_ratio'
op|'='
number|'16.0'
op|','
name|'ram_allocation_ratio'
op|'='
number|'1.5'
op|','
nl|'\n'
name|'disk_allocation_ratio'
op|'='
number|'1.0'
op|')'
newline|'\n'
name|'host'
op|'='
name|'host_manager'
op|'.'
name|'HostState'
op|'('
string|'"fakehost"'
op|','
string|'"fakenode"'
op|')'
newline|'\n'
name|'host'
op|'.'
name|'update'
op|'('
name|'compute'
op|'='
name|'compute'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'len'
op|'('
name|'host'
op|'.'
name|'metrics'
op|')'
op|','
number|'2'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
number|'1.0'
op|','
name|'host'
op|'.'
name|'metrics'
op|'.'
name|'to_list'
op|'('
op|')'
op|'['
number|'0'
op|']'
op|'['
string|"'value'"
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
string|"'source1'"
op|','
name|'host'
op|'.'
name|'metrics'
op|'['
number|'0'
op|']'
op|'.'
name|'source'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
string|"'cpu.frequency'"
op|','
name|'host'
op|'.'
name|'metrics'
op|'['
number|'0'
op|']'
op|'.'
name|'name'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
string|"'numa.membw.current'"
op|','
name|'host'
op|'.'
name|'metrics'
op|'['
number|'1'
op|']'
op|'.'
name|'name'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
string|"'source2'"
op|','
name|'host'
op|'.'
name|'metrics'
op|'.'
name|'to_list'
op|'('
op|')'
op|'['
number|'1'
op|']'
op|'['
string|"'source'"
op|']'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
op|'{'
string|"'0'"
op|':'
number|'10'
op|','
string|"'1'"
op|':'
number|'43'
op|'}'
op|','
nl|'\n'
name|'host'
op|'.'
name|'metrics'
op|'['
number|'1'
op|']'
op|'.'
name|'numa_membw_values'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertIsInstance'
op|'('
name|'host'
op|'.'
name|'numa_topology'
op|','
name|'six'
op|'.'
name|'string_types'
op|')'
newline|'\n'
dedent|''
dedent|''
endmarker|''
end_unit
| 12.224037
| 88
| 0.606117
| 16,096
| 106,288
| 3.853752
| 0.02833
| 0.178269
| 0.080606
| 0.067258
| 0.939916
| 0.921248
| 0.898759
| 0.884169
| 0.860729
| 0.839932
| 0
| 0.006387
| 0.089596
| 106,288
| 8,694
| 89
| 12.225443
| 0.634651
| 0
| 0
| 0.972395
| 0
| 0
| 0.375358
| 0.042978
| 0
| 0
| 0
| 0
| 0.013688
| 0
| null | null | 0.00069
| 0.00253
| null | null | 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
ed95630427f2cc0fa6115167f4083a93272c222d
| 33,986
|
py
|
Python
|
anno_repo/tf_record.py
|
annomator/annomator_package_beta_0.1
|
134d5c3b2818cf196021ed1ce61424259e80d7f6
|
[
"Apache-2.0"
] | 14
|
2019-03-28T06:00:28.000Z
|
2022-02-28T06:13:28.000Z
|
anno_repo/tf_record.py
|
annomator/annomator_package_beta_0.1
|
134d5c3b2818cf196021ed1ce61424259e80d7f6
|
[
"Apache-2.0"
] | 16
|
2020-01-28T22:12:17.000Z
|
2022-02-10T00:13:24.000Z
|
anno_repo/tf_record.py
|
annomator/annomator_package_beta_0.1
|
134d5c3b2818cf196021ed1ce61424259e80d7f6
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2019 Annomator Written by Arend Smits
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
# 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.
# Python 2.7
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import hashlib
import io
import os
import numpy as np
import PIL.Image
import tensorflow as tf
#import json # NOT NEEDED
#from pycocotools import mask # NOT NEEDED
import time
import gen_functions
tsf = gen_functions.time_seconds_format
import png_masks
# As specific io format, do not use image utils
# From TFOD/utils/dataset_utils.py
def int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
def int64_list_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
def bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def bytes_list_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=value))
def float_list_feature(value):
return tf.train.Feature(float_list=tf.train.FloatList(value=value))
def create_tf_example_for_boxes_area(
boxes_dict, category_index, image_path, image_height,
image_width, image_id, skipped_images, skipped_annos,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM, PIXEL_AREA_MIN,
valid_cat_ids, translation_index, cat_count_list_total):
# Image name used as image id
image_filename = os.path.basename(image_path)
image_name, _ = os.path.splitext(image_filename)
filename = image_filename
# Encode image
with tf.gfile.GFile(image_path, 'rb') as fid:
encoded_jpg = fid.read()
encoded_jpg_io = io.BytesIO(encoded_jpg)
image = PIL.Image.open(encoded_jpg_io)
key = hashlib.sha256(encoded_jpg).hexdigest()
# vars
category_ids = []
Xmins = []
Xmaxs = []
Ymins = []
Ymaxs = []
pixel_areas = []
cat_count_list_image = [0] * (max(category_index.keys()) +1)
total_annos = len(boxes_dict['cat_ids'])
# check
for i in range(total_annos):
cat_id = boxes_dict['cat_ids'][i]
area = boxes_dict['areas'][i]
if SAMPLE_CATEGORIES:
if cat_id not in valid_cat_ids:
#print("not valid", cat_id)
skipped_annos +=1
continue
threshold_count = cat_count_list_total[cat_id] + cat_count_list_image[cat_id]
if threshold_count >= CATEGORY_SAMPLE_NUM:
#print("over threshold", threshold_count)
skipped_annos +=1
continue
if area < PIXEL_AREA_MIN:
#print("less than area min", area)
skipped_annos +=1
continue
# append
pixel_areas.append(area)
cat_count_list_image[cat_id] +=1
if translation_index == {}:
category_ids.append(cat_id)
else:
for tid in translation_index.keys():
if translation_index[tid]['coco_id'] == cat_id:
category_ids.append(tid)
# Translate coco xywh pixels to yxyx norm
left = boxes_dict['boxes'][i][0] / image_width
Xmins.append(left)
right = left + (boxes_dict['boxes'][i][2] / image_width)
Xmaxs.append(right)
top = boxes_dict['boxes'][i][1] / image_height
Ymins.append(top)
bottom = top + (boxes_dict['boxes'][i][3] / image_height)
Ymaxs.append(bottom)
# Return none if none, report, and skip
if max(cat_count_list_image) == 0:
skipped_images +=1
#print("Skipping mask - No instances found to add", os.path.basename(mask_path))
return None, cat_count_list_total, skipped_images, skipped_annos
# Add to feature dict and return tf exampe
for vid in valid_cat_ids:
cat_count_list_total[vid] += cat_count_list_image[vid]
feature_dict = {
'image/height': int64_feature(image_height),
'image/width': int64_feature(image_width),
'image/filename': bytes_feature(filename.encode('utf8')),
'image/source_id': bytes_feature(str(image_id).encode('utf8')),
'image/key/sha256': bytes_feature(key.encode('utf8')),
'image/encoded': bytes_feature(encoded_jpg),
'image/format': bytes_feature('jpeg'.encode('utf8')),
'image/object/bbox/xmin': float_list_feature(Xmins),
'image/object/bbox/xmax': float_list_feature(Xmaxs),
'image/object/bbox/ymin': float_list_feature(Ymins),
'image/object/bbox/ymax': float_list_feature(Ymaxs),
'image/object/class/label': int64_list_feature(category_ids),
'image/object/area': float_list_feature(pixel_areas)}
tf_example = tf.train.Example(features=tf.train.Features(feature=feature_dict))
return tf_example, cat_count_list_total, skipped_images, skipped_annos
# removed 'image/object/mask': bytes_list_feature(binary_mask_list)
# removed 'image/object/is_crowd': int64_list_feature(is_crowd),
# removed key as not used when returned
def create_tf_example_for_boxes_score(
boxes_dict, category_index, image_path, image_height,
image_width, skipped_images, skipped_annos,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM,
valid_cat_ids, translation_index, cat_count_list_total):
# Image name used as image id
image_filename = os.path.basename(image_path)
image_name, _ = os.path.splitext(image_filename)
filename = image_filename
# Encode image
with tf.gfile.GFile(image_path, 'rb') as fid:
encoded_jpg = fid.read()
encoded_jpg_io = io.BytesIO(encoded_jpg)
image = PIL.Image.open(encoded_jpg_io)
key = hashlib.sha256(encoded_jpg).hexdigest()
# vars
category_ids = []
Xmins = []
Xmaxs = []
Ymins = []
Ymaxs = []
scores = []
cat_count_list_image = [0] * (max(category_index.keys()) +1)
total_annos = len(boxes_dict['cat_ids'])
# check
for i in range(total_annos):
cat_id = boxes_dict['cat_ids'][i]
score = boxes_dict['scores'][i]
if SAMPLE_CATEGORIES:
if cat_id not in valid_cat_ids:
skipped_annos +=1
continue
threshold_count = cat_count_list_total[cat_id] + cat_count_list_image[cat_id]
if threshold_count >= CATEGORY_SAMPLE_NUM:
#print("over threshold", threshold_count)
skipped_annos +=1
continue
scores.append(score)
cat_count_list_image[cat_id] +=1
if translation_index == {}:
category_ids.append(cat_id)
else:
for tid in translation_index.keys():
if translation_index[tid]['coco_id'] == cat_id:
category_ids.append(tid)
# Translate detection box from yxyx
left = boxes_dict['boxes'][i][1]
Xmins.append(left)
right = boxes_dict['boxes'][i][3]
Xmaxs.append(right)
top = boxes_dict['boxes'][i][0]
Ymins.append(top)
bottom = boxes_dict['boxes'][i][2]
Ymaxs.append(bottom)
# Return none if none, report, and skip
if max(cat_count_list_image) == 0:
skipped_images +=1
#print("Skipping mask - No instances found to add", os.path.basename(mask_path))
return None, cat_count_list_total, skipped_images, skipped_annos
# Add to feature dict and return tf exampe
for vid in valid_cat_ids:
cat_count_list_total[vid] += cat_count_list_image[vid]
feature_dict = {
'image/height': int64_feature(image_height),
'image/width': int64_feature(image_width),
'image/filename': bytes_feature(filename.encode('utf8')),
'image/key/sha256': bytes_feature(key.encode('utf8')),
'image/encoded': bytes_feature(encoded_jpg),
'image/format': bytes_feature('jpeg'.encode('utf8')),
'image/object/bbox/xmin': float_list_feature(Xmins),
'image/object/bbox/xmax': float_list_feature(Xmaxs),
'image/object/bbox/ymin': float_list_feature(Ymins),
'image/object/bbox/ymax': float_list_feature(Ymaxs),
'image/object/class/label': int64_list_feature(category_ids),
'image/object/score': float_list_feature(scores)}
# removed 'image/source_id': bytes_feature(str(image_id).encode('utf8')),
tf_example = tf.train.Example(features=tf.train.Features(feature=feature_dict))
return tf_example, cat_count_list_total, skipped_images, skipped_annos
# removed 'image/object/mask': bytes_list_feature(binary_mask_list)
# removed 'image/object/is_crowd': int64_list_feature(is_crowd),
# removed key as not used when returned
def create_tf_record_from_json_panoptic(
json_loaded, category_index,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM, PIXEL_AREA_MIN,
valid_cat_ids, translation_index,
images, IMAGES_DIR, image_ids, heights, widths,
output_path):
# Finds masks for a list of images
print('Writing', os.path.basename(output_path))
images_start = time.time()
image_count = 0
mask_count = 0
skipped_images = 0
skipped_annos = 0
cat_count_list_total = [0] * (max(valid_cat_ids) + 1)
image_avg = 0
boxes_dict = {}
images_used = 0
writer = tf.python_io.TFRecordWriter(output_path)
for i, image in enumerate(images):
image_name, image_ext = os.path.splitext(image)
if image_ext != ".jpg":
# can store png masks and visuals 'all-in-one' with simple skip
continue # only setup for jpgs
image_path = os.path.join(IMAGES_DIR, image)
image_count +=1
image_id = image_ids[i]
image_height = heights[i]
image_width = widths[i]
boxes_dict = {}
cat_ids = []
boxes = []
areas = []
annotations = json_loaded['annotations']
# Not keyed so going to iterate
anno = ""
for annotation in annotations:
if image_id == annotation['image_id']:
anno = annotation['segments_info']
break
if anno == "":
print("No annotation found for image", image)
skipped_images +=1
continue
for a in anno:
if a['category_id'] > 90:
# skip if not coco 'things'
continue
if a['iscrowd'] != 0:
# skip if crowd
continue
cat_ids.append(a['category_id'])
# coco is xy wh pixels
# tf od is yxyx norm
boxes.append(a['bbox'])
areas.append(a['area'])
boxes_dict['cat_ids'] = cat_ids
boxes_dict['boxes'] = boxes
boxes_dict['areas'] = areas
if len(boxes_dict) == 0:
skipped_images +=1
print('Skipping image. No json refs for', image)
continue
tf_example, cat_count_list_total, skipped_images, skipped_annos = create_tf_example_for_boxes_area(
boxes_dict, category_index, image_path, image_height,
image_width, image_id, skipped_images, skipped_annos,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM, PIXEL_AREA_MIN,
valid_cat_ids, translation_index, cat_count_list_total)
if tf_example != None:
writer.write(tf_example.SerializeToString())
# Should match total processed minus skipped at end
images_used += 1
if SAMPLE_CATEGORIES:
finished_sampling = True
for vid in valid_cat_ids:
if cat_count_list_total[vid] < CATEGORY_SAMPLE_NUM:
finished_sampling = False
if finished_sampling:
for vid in valid_cat_ids:
print(vid, category_index[vid]['name'], cat_count_list_total[vid])
print("Category sampling complete - quoto achieved")
print('-'*50)
break
# Reporting
if image_count % 1000 == 0:
image_time_total = time.time() - images_start
image_time_mean = image_time_total / image_count
if SAMPLE_CATEGORIES:
for vid in valid_cat_ids:
print(vid, category_index[vid]['name'], cat_count_list_total[vid])
print('Images %d Average %s' % (image_count, tsf(image_time_mean)))
writer.close()
for vid in valid_cat_ids:
print(vid, category_index[vid]['name'], cat_count_list_total[vid])
print('%d images skipped as no annotations to add' % (skipped_images))
print('%d annotations skipped due to sampling' % (skipped_annos))
print('Processed %d images and %d masks' % (image_count, mask_count))
print('Total Images to TF Record File %d' % (images_used))
print('-'*50)
return images_used
def create_tf_record_from_json_annotate(
json_loaded, category_index,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM,
valid_cat_ids, translation_index,
images, IMAGES_DIR, heights, widths,
output_path):
# Finds masks for a list of images
# Note category index will use pbtxt but also included in json
# Scores used. No area information included.
print('Writing', os.path.basename(output_path))
images_start = time.time()
image_count = 0
mask_count = 0
skipped_images = 0
skipped_annos = 0
cat_count_list_total = [0] * (max(valid_cat_ids) + 1)
image_avg = 0
boxes_dict = {}
images_used = 0
writer = tf.python_io.TFRecordWriter(output_path)
for i, image in enumerate(images):
image_name, image_ext = os.path.splitext(image)
if image_ext != ".jpg":
# can store png masks and visuals 'all-in-one' with simple skip
continue # only setup for jpgs
image_path = os.path.join(IMAGES_DIR, image)
image_count +=1
image_height = heights[i]
image_width = widths[i]
boxes_dict = {}
cat_ids = []
boxes = []
scores = []
for ref in json_loaded['images']:
if ref['image'] == image:
print(image)
for instance in ref['instances']:
if instance['instance_id'] == 0:
# No instances for image
continue
cat_ids.append(instance['category_id'])
boxes.append(instance['box'])
scores.append(instance['score'])
boxes_dict['cat_ids'] = cat_ids
boxes_dict['boxes'] = boxes
boxes_dict['scores'] = scores
if len(boxes_dict) == 0:
skipped_images +=1
print('Skipping image. No json refs for', image)
continue
tf_example, cat_count_list_total, skipped_images, skipped_annos = create_tf_example_for_boxes_score(
boxes_dict, category_index, image_path, image_height,
image_width, skipped_images, skipped_annos,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM,
valid_cat_ids, translation_index, cat_count_list_total)
if tf_example != None:
writer.write(tf_example.SerializeToString())
# Should match total processed minus skipped at end
images_used += 1
if SAMPLE_CATEGORIES:
finished_sampling = True
for vid in valid_cat_ids:
if cat_count_list_total[vid] < CATEGORY_SAMPLE_NUM:
finished_sampling = False
if finished_sampling:
for vid in valid_cat_ids:
print(vid, category_index[vid]['name'], cat_count_list_total[vid])
print("Category sampling complete - quoto achieved")
print('-'*50)
break
# Reporting
if image_count % 1000 == 0:
image_time_total = time.time() - images_start
image_time_mean = image_time_total / image_count
if SAMPLE_CATEGORIES:
for vid in valid_cat_ids:
print(vid, category_index[vid]['name'], cat_count_list_total[vid])
print('Images %d Average %s' % (image_count, tsf(image_time_mean)))
writer.close()
for vid in valid_cat_ids:
print(vid, category_index[vid]['name'], cat_count_list_total[vid])
print('%d images skipped as no annotations to add' % (skipped_images))
print('%d annotations skipped due to sampling' % (skipped_annos))
print('Processed %d images and %d masks' % (image_count, mask_count))
print('Total Images to TF Record File %d' % (images_used))
print('-'*50)
return images_used
def create_tf_example_for_masks(
built_dict, category_index,
image_path, mask_path,
skipped_masks, skipped_annos,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM, PIXEL_AREA_MIN,
valid_cat_ids, translation_index, cat_count_list_total):
# Image name used as image id
image_filename = os.path.basename(image_path)
image_name, _ = os.path.splitext(image_filename)
image_id = image_name
filename = image_filename
# Encode image
with tf.gfile.GFile(image_path, 'rb') as fid:
encoded_jpg = fid.read()
encoded_jpg_io = io.BytesIO(encoded_jpg)
image = PIL.Image.open(encoded_jpg_io)
key = hashlib.sha256(encoded_jpg).hexdigest()
image_width, image_height = image.size
# vars
category_ids = []
Xmins = []
Xmaxs = []
Ymins = []
Ymaxs = []
pixel_areas = []
binary_mask_list = []
cat_count_list_image = [0] * (max(category_index.keys()) +1)
# total handed in function
total_built = len(built_dict['classes'])
# check
for i in range(total_built):
cat_id = int(built_dict['classes'][i])
area = (built_dict['masks'][i]).sum()
if SAMPLE_CATEGORIES:
if cat_id not in valid_cat_ids:
#print("not valid", cat_id)
skipped_annos +=1
continue
threshold_count = cat_count_list_total[cat_id] + cat_count_list_image[cat_id]
if threshold_count >= CATEGORY_SAMPLE_NUM:
#print("over threshold", threshold_count)
skipped_annos +=1
continue
if area < PIXEL_AREA_MIN:
print("less than area min", area)
skipped_annos +=1
continue
# append
pixel_areas.append(area)
cat_count_list_image[cat_id] +=1
if translation_index == {}:
category_ids.append(cat_id)
else:
for tid in translation_index.keys():
if translation_index[tid]['coco_id'] == cat_id:
category_ids.append(tid)
left = built_dict['boxes'][i][1]
Xmins.append(left)
right = built_dict['boxes'][i][3]
Xmaxs.append(right)
top = built_dict['boxes'][i][0]
Ymins.append(top)
bottom = built_dict['boxes'][i][2]
Ymaxs.append(bottom)
binary_mask = built_dict['masks'][i]
binary_image = PIL.Image.fromarray(binary_mask)
output = io.BytesIO()
binary_image.save(output, format='PNG')
binary_mask_list.append(output.getvalue())
# Return none if none, report, and skip
if max(cat_count_list_image) == 0:
skipped_masks +=1
#print("Skipping mask - No instances found to add", os.path.basename(mask_path))
return None, cat_count_list_total, skipped_masks, skipped_annos
# Add to feature dict and return tf exampe
for vid in valid_cat_ids:
cat_count_list_total[vid] += cat_count_list_image[vid]
feature_dict = {
'image/height': int64_feature(image_height),
'image/width': int64_feature(image_width),
'image/filename': bytes_feature(filename.encode('utf8')),
'image/source_id': bytes_feature(str(image_id).encode('utf8')),
'image/key/sha256': bytes_feature(key.encode('utf8')),
'image/encoded': bytes_feature(encoded_jpg),
'image/format': bytes_feature('jpeg'.encode('utf8')),
'image/object/bbox/xmin': float_list_feature(Xmins),
'image/object/bbox/xmax': float_list_feature(Xmaxs),
'image/object/bbox/ymin': float_list_feature(Ymins),
'image/object/bbox/ymax': float_list_feature(Ymaxs),
'image/object/class/label': int64_list_feature(category_ids),
'image/object/area': float_list_feature(pixel_areas),
'image/object/mask': bytes_list_feature(binary_mask_list)}
tf_example = tf.train.Example(features=tf.train.Features(feature=feature_dict))
return tf_example, cat_count_list_total, skipped_masks, skipped_annos
# removed 'image/object/is_crowd': int64_list_feature(is_crowd),
# removed key as not used when returned
def create_tf_example_from_masks_for_boxes(
built_dict, category_index,
image_path, mask_path,
skipped_masks, skipped_annos,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM, PIXEL_AREA_MIN,
valid_cat_ids, translation_index, cat_count_list_total):
# Image name used as image id
image_filename = os.path.basename(image_path)
image_name, _ = os.path.splitext(image_filename)
image_id = image_name
filename = image_filename
# Encode image
with tf.gfile.GFile(image_path, 'rb') as fid:
encoded_jpg = fid.read()
encoded_jpg_io = io.BytesIO(encoded_jpg)
image = PIL.Image.open(encoded_jpg_io)
key = hashlib.sha256(encoded_jpg).hexdigest()
image_width, image_height = image.size
# vars
category_ids = []
Xmins = []
Xmaxs = []
Ymins = []
Ymaxs = []
pixel_areas = []
binary_mask_list = []
cat_count_list_image = [0] * (max(category_index.keys()) +1)
# total handed in function
total_built = len(built_dict['classes'])
# check
for i in range(total_built):
cat_id = int(built_dict['classes'][i])
area = (built_dict['masks'][i]).sum()
if SAMPLE_CATEGORIES:
if cat_id not in valid_cat_ids:
#print("not valid", cat_id)
skipped_annos +=1
continue
threshold_count = cat_count_list_total[cat_id] + cat_count_list_image[cat_id]
if threshold_count >= CATEGORY_SAMPLE_NUM:
#print("over threshold", threshold_count)
skipped_annos +=1
continue
if area < PIXEL_AREA_MIN:
print("less than area min", area)
skipped_annos +=1
continue
# append
pixel_areas.append(area)
cat_count_list_image[cat_id] +=1
if translation_index == {}:
category_ids.append(cat_id)
else:
for tid in translation_index.keys():
if translation_index[tid]['coco_id'] == cat_id:
category_ids.append(tid)
left = built_dict['boxes'][i][1]
Xmins.append(left)
right = built_dict['boxes'][i][3]
Xmaxs.append(right)
top = built_dict['boxes'][i][0]
Ymins.append(top)
bottom = built_dict['boxes'][i][2]
Ymaxs.append(bottom)
binary_mask = built_dict['masks'][i]
binary_image = PIL.Image.fromarray(binary_mask)
output = io.BytesIO()
binary_image.save(output, format='PNG')
binary_mask_list.append(output.getvalue())
# Return none if none, report, and skip
if max(cat_count_list_image) == 0:
skipped_masks +=1
#print("Skipping mask - No instances found to add", os.path.basename(mask_path))
return None, cat_count_list_total, skipped_masks, skipped_annos
# Add to feature dict and return tf exampe
for vid in valid_cat_ids:
cat_count_list_total[vid] += cat_count_list_image[vid]
feature_dict = {
'image/height': int64_feature(image_height),
'image/width': int64_feature(image_width),
'image/filename': bytes_feature(filename.encode('utf8')),
'image/source_id': bytes_feature(str(image_id).encode('utf8')),
'image/key/sha256': bytes_feature(key.encode('utf8')),
'image/encoded': bytes_feature(encoded_jpg),
'image/format': bytes_feature('jpeg'.encode('utf8')),
'image/object/bbox/xmin': float_list_feature(Xmins),
'image/object/bbox/xmax': float_list_feature(Xmaxs),
'image/object/bbox/ymin': float_list_feature(Ymins),
'image/object/bbox/ymax': float_list_feature(Ymaxs),
'image/object/class/label': int64_list_feature(category_ids),
'image/object/area': float_list_feature(pixel_areas)}
# removed 'image/object/mask': bytes_list_feature(binary_mask_list)
tf_example = tf.train.Example(features=tf.train.Features(feature=feature_dict))
return tf_example, cat_count_list_total, skipped_masks, skipped_annos
# removed 'image/object/is_crowd': int64_list_feature(is_crowd),
# removed key as not used when returned
def create_tf_record_from_png_masks(
CODEC, CODEC_OFFSET, category_index,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM, PIXEL_AREA_MIN,
valid_cat_ids, translation_index,
images, IMAGES_DIR, MASKS_DIR, MASK_EXT,
output_path):
# Finds masks for a list of images
print('Writing', os.path.basename(output_path))
images_start = time.time()
image_count = 0
mask_count = 0
skipped_images = 0
skipped_masks = 0
skipped_annos = 0
cat_count_list_total = [0] * (max(valid_cat_ids) + 1)
image_avg = 0
built_dict = {}
writer = tf.python_io.TFRecordWriter(output_path)
for image in images:
image_name, image_ext = os.path.splitext(image)
if image_ext != ".jpg":
# can store png masks and png visuals ('all-in-one') with simple skip
continue # only setup for jpg images, all masks are png
image_path = os.path.join(IMAGES_DIR, image)
image_count +=1
mask_found = False
if CODEC == "binary_filename":
mask_path = (os.path.join(MASKS_DIR, image_name))
if os.path.isdir(mask_path):
mask_count +=1
mask_found = True
built_dict = png_masks.rebuild_from_binary_mask_dir(mask_path)
else:
mask_path = os.path.join(MASKS_DIR, image_name + MASK_EXT)
if os.path.isfile(mask_path):
mask_count +=1
mask_found = True
# load mask_np and get built dict for image
mask = PIL.Image.open(mask_path)
mask_np = np.array(mask).astype(np.uint8)
built_dict = png_masks.rebuild_from_mask(
mask_np, CODEC, CODEC_OFFSET, category_index)
if not mask_found or len(built_dict) == 0:
skipped_images +=1
print('Skipping image: no mask found for', image)
continue
tf_example, cat_count_list_total, skipped_masks, skipped_annos = create_tf_example_for_masks(
built_dict, category_index,
image_path, mask_path,
skipped_masks, skipped_annos,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM, PIXEL_AREA_MIN,
valid_cat_ids, translation_index, cat_count_list_total)
if tf_example != None:
writer.write(tf_example.SerializeToString())
if SAMPLE_CATEGORIES:
finished_sampling = True
for vid in valid_cat_ids:
if cat_count_list_total[vid] < CATEGORY_SAMPLE_NUM:
finished_sampling = False
if finished_sampling:
for vid in valid_cat_ids:
print(vid, category_index[vid]['name'], cat_count_list_total[vid])
print("Category sampling complete - quoto achieved")
print('-'*50)
break
# Reporting
if image_count % 10 == 0:
image_time_total = time.time() - images_start
image_time_mean = image_time_total / image_count
if SAMPLE_CATEGORIES:
for vid in valid_cat_ids:
print(vid, category_index[vid]['name'], cat_count_list_total[vid])
print('Images %d Average %s' % (image_count, tsf(image_time_mean)))
writer.close()
# Reporting
print('%d images skipped as no mask' % (skipped_images))
print('%d masks skipped due to sampling' % (skipped_masks))
print('%d annotations skipped due to sampling' % (skipped_annos))
print('Completed %d images and %d masks' % (image_count, mask_count))
print('-'*50)
def create_tf_record_from_png_masks_for_boxes(
CODEC, CODEC_OFFSET, category_index,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM, PIXEL_AREA_MIN,
valid_cat_ids, translation_index,
images, IMAGES_DIR, MASKS_DIR, MASK_EXT,
output_path):
# Finds masks for a list of images
print('Writing', os.path.basename(output_path))
images_start = time.time()
image_count = 0
mask_count = 0
skipped_images = 0
skipped_masks = 0
skipped_annos = 0
cat_count_list_total = [0] * (max(valid_cat_ids) + 1)
image_avg = 0
built_dict = {}
writer = tf.python_io.TFRecordWriter(output_path)
for image in images:
image_name, image_ext = os.path.splitext(image)
if image_ext != ".jpg":
# can store png masks and png visuals ('all-in-one') with simple skip
continue # only setup for jpg images, all masks are png
image_path = os.path.join(IMAGES_DIR, image)
image_count +=1
mask_found = False
if CODEC == "binary_filename":
mask_path = (os.path.join(MASKS_DIR, image_name))
if os.path.isdir(mask_path):
mask_count +=1
mask_found = True
built_dict = png_masks.rebuild_from_binary_mask_dir(mask_path)
else:
mask_path = os.path.join(MASKS_DIR, image_name + MASK_EXT)
if os.path.isfile(mask_path):
mask_count +=1
mask_found = True
# load mask_np and get built dict for image
mask = PIL.Image.open(mask_path)
mask_np = np.array(mask).astype(np.uint8)
built_dict = png_masks.rebuild_from_mask(
mask_np, CODEC, CODEC_OFFSET, category_index)
if not mask_found or len(built_dict) == 0:
skipped_images +=1
print('Skipping image: no mask found for', image)
continue
tf_example, cat_count_list_total, skipped_masks, skipped_annos = create_tf_example_from_masks_for_boxes(
built_dict, category_index,
image_path, mask_path,
skipped_masks, skipped_annos,
SAMPLE_CATEGORIES, CATEGORY_SAMPLE_NUM, PIXEL_AREA_MIN,
valid_cat_ids, translation_index, cat_count_list_total)
if tf_example != None:
writer.write(tf_example.SerializeToString())
if SAMPLE_CATEGORIES:
finished_sampling = True
for vid in valid_cat_ids:
if cat_count_list_total[vid] < CATEGORY_SAMPLE_NUM:
finished_sampling = False
if finished_sampling:
for vid in valid_cat_ids:
print(vid, category_index[vid]['name'], cat_count_list_total[vid])
print("Category sampling complete - quoto achieved")
print('-'*50)
break
# Reporting
if image_count % 10 == 0:
image_time_total = time.time() - images_start
image_time_mean = image_time_total / image_count
if SAMPLE_CATEGORIES:
for vid in valid_cat_ids:
print(vid, category_index[vid]['name'], cat_count_list_total[vid])
print('Images %d Average %s' % (image_count, tsf(image_time_mean)))
writer.close()
# Reporting
print('%d images skipped as no mask' % (skipped_images))
print('%d masks skipped due to sampling' % (skipped_masks))
print('%d annotations skipped due to sampling' % (skipped_annos))
print('Completed %d images and %d masks' % (image_count, mask_count))
print('-'*50)
| 39.749708
| 128
| 0.609839
| 4,216
| 33,986
| 4.625474
| 0.075427
| 0.027076
| 0.040613
| 0.040101
| 0.903441
| 0.89939
| 0.898313
| 0.893595
| 0.886108
| 0.883903
| 0
| 0.009785
| 0.296328
| 33,986
| 854
| 129
| 39.796253
| 0.805645
| 0.109192
| 0
| 0.882716
| 0
| 0
| 0.083595
| 0.01528
| 0
| 0
| 0
| 0
| 0
| 1
| 0.020062
| false
| 0
| 0.018519
| 0.007716
| 0.061728
| 0.084877
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
edacfc2629f202848d268c38c5d0bcd93dfff92b
| 87
|
py
|
Python
|
loadbank/__init__.py
|
kanosuke/loadbank
|
d16e71fd60371fc034127cb9cb2b67d83d4bc4e5
|
[
"MIT"
] | null | null | null |
loadbank/__init__.py
|
kanosuke/loadbank
|
d16e71fd60371fc034127cb9cb2b67d83d4bc4e5
|
[
"MIT"
] | null | null | null |
loadbank/__init__.py
|
kanosuke/loadbank
|
d16e71fd60371fc034127cb9cb2b67d83d4bc4e5
|
[
"MIT"
] | null | null | null |
from .load_bank import load_bank_classifier
from .load_bank import load_bank_regressor
| 29
| 43
| 0.885057
| 14
| 87
| 5.071429
| 0.428571
| 0.450704
| 0.338028
| 0.507042
| 0.732394
| 0.732394
| 0
| 0
| 0
| 0
| 0
| 0
| 0.091954
| 87
| 2
| 44
| 43.5
| 0.898734
| 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
| 1
| 1
| 0
| 1
| 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
| 8
|
edc2cdc5eadd714bdbf227eff949ac748e60b7b1
| 8,784
|
py
|
Python
|
reduction/imaging_continuum.py
|
keflavich/W51_VLA-16B-202
|
4c743c5d001e097f1d184a550e6d21441ca02f2d
|
[
"BSD-3-Clause"
] | null | null | null |
reduction/imaging_continuum.py
|
keflavich/W51_VLA-16B-202
|
4c743c5d001e097f1d184a550e6d21441ca02f2d
|
[
"BSD-3-Clause"
] | null | null | null |
reduction/imaging_continuum.py
|
keflavich/W51_VLA-16B-202
|
4c743c5d001e097f1d184a550e6d21441ca02f2d
|
[
"BSD-3-Clause"
] | null | null | null |
# SB1 may have terrible calibration (is 2x as faint, and wasn't appropriately
# statwt'd b/c it didn't go through the pipeline)
vis = [#'16B-202.sb32532587.eb32875589.57663.07622001157.ms',
'16B-202.sb32957824.eb33105444.57748.63243916667.ms',
'16B-202.sb32957824.eb33142274.57752.64119381944.ms',
'16B-202.sb32957824.eb33234671.57760.62953023148.ms',
]
contspw = '2,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,22,23,24,25,26,28,29,30,31,32,34,35,36,37,39,42,44,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,62,63,64'
"""
Normal, shallow tclean imaging of both fields
"""
output = myimagebase = imagename = 'W51e2w_QbandAarray_cont_spws_continuum_cal_clean_robust0_wproj'
tclean(vis=vis,
imagename=imagename,
field='W51e2w',
spw=contspw,
weighting='briggs',
robust=0.0,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
outframe='LSRK',
savemodel='none',
selectdata=True)
impbcor(imagename=myimagebase+'.image', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.pbcor', fitsimage=myimagebase+'.image.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for suffix in ('pb', 'weight', 'sumwt', 'psf', 'model', 'mask',
'image', 'residual'):
os.system('rm -rf {0}.{1}'.format(output, suffix))
output = myimagebase = imagename = 'W51North_QbandAarray_cont_spws_continuum_cal_clean_robust0_wproj'
tclean(vis=vis,
imagename=imagename,
field='W51 North',
spw=contspw,
weighting='briggs',
robust=0.0,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
outframe='LSRK',
savemodel='none',
selectdata=True)
impbcor(imagename=myimagebase+'.image', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.pbcor', fitsimage=myimagebase+'.image.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for suffix in ('pb', 'weight', 'sumwt', 'psf', 'model', 'mask',
'image', 'residual'):
os.system('rm -rf {0}.{1}'.format(output, suffix))
"""
nterms=2, spectral slope cleaning
"""
output = myimagebase = imagename = 'W51e2w_QbandAarray_cont_spws_continuum_cal_clean_2terms_robust0_wproj'
tclean(vis=vis,
imagename=imagename,
field='W51e2w',
spw=contspw,
weighting='briggs',
robust=0.0,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
deconvolver='mtmfs',
outframe='LSRK',
savemodel='none',
nterms=2,
selectdata=True)
impbcor(imagename=myimagebase+'.image.tt0', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.tt0.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.tt0.pbcor', fitsimage=myimagebase+'.image.tt0.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for suffix in ('pb', 'weight', 'sumwt', 'psf', 'model', 'mask',
'image', 'residual'):
os.system('rm -rf {0}.{1}'.format(output, suffix))
output = myimagebase = imagename = 'W51North_QbandAarray_cont_spws_continuum_cal_clean_2terms_robust0_wproj'
tclean(vis=vis,
imagename=imagename,
field='W51 North',
spw=contspw,
weighting='briggs',
robust=0.0,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
deconvolver='mtmfs',
outframe='LSRK',
savemodel='none',
nterms=2,
selectdata=True)
impbcor(imagename=myimagebase+'.image.tt0', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.tt0.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.tt0.pbcor', fitsimage=myimagebase+'.image.tt0.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for suffix in ('pb', 'weight', 'sumwt', 'psf', 'model', 'mask',
'image', 'residual'):
os.system('rm -rf {0}.{1}'.format(output, suffix))
for robust,suffix in [(-2,'uniform'), (0,'robust0'), (2,'natural')]:
output = myimagebase = imagename = 'W51e5_QbandAarray_cont_spws_continuum_cal_clean_{0}_wproj'.format(suffix)
tclean(vis=vis,
imagename=imagename,
field='W51e2w,W51 North',
phasecenter="J2000 19h23m41.858 +14d30m56.674",
spw=contspw,
weighting='briggs',
robust=robust,
imsize=[2560,2560],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
outframe='LSRK',
savemodel='none',
selectdata=True)
impbcor(imagename=myimagebase+'.image', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.pbcor', fitsimage=myimagebase+'.image.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for robust,suffix in [(-2,'uniform'), (0,'robust0'), (2,'natural')]:
output = myimagebase = imagename = 'W51North_QbandAarray_cont_spws_continuum_cal_clean_{0}_wproj'.format(suffix)
tclean(vis=vis,
imagename=imagename,
field='W51 North',
spw=contspw,
weighting='briggs',
robust=robust,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
outframe='LSRK',
savemodel='none',
selectdata=True)
impbcor(imagename=myimagebase+'.image', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.pbcor', fitsimage=myimagebase+'.image.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for robust,suffix in [(-2,'uniform'), (0,'robust0'), (2,'natural')]:
output = myimagebase = imagename = 'W51e2w_QbandAarray_cont_spws_continuum_cal_clean_{0}_wproj'.format(suffix)
tclean(vis=vis,
imagename=imagename,
field='W51e2w',
spw=contspw,
weighting='briggs',
robust=robust,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
outframe='LSRK',
savemodel='none',
selectdata=True)
impbcor(imagename=myimagebase+'.image', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.pbcor', fitsimage=myimagebase+'.image.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for suffix in ('pb', 'weight', 'sumwt', 'psf', 'model', 'mask',
'image', 'residual'):
os.system('rm -rf {0}.{1}'.format(output, suffix))
| 41.046729
| 157
| 0.654485
| 993
| 8,784
| 5.731118
| 0.186304
| 0.098401
| 0.084871
| 0.125461
| 0.911615
| 0.911615
| 0.911615
| 0.904059
| 0.904059
| 0.904059
| 0
| 0.069163
| 0.185223
| 8,784
| 213
| 158
| 41.239437
| 0.726003
| 0.020036
| 0
| 0.909091
| 0
| 0.005682
| 0.2448
| 0.091433
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
edcf6d2f8de4e1a2fe9730822e8b52477312820d
| 1,166
|
py
|
Python
|
temboo/core/Library/PagerDuty/Incidents/__init__.py
|
jordanemedlock/psychtruths
|
52e09033ade9608bd5143129f8a1bfac22d634dd
|
[
"Apache-2.0"
] | 7
|
2016-03-07T02:07:21.000Z
|
2022-01-21T02:22:41.000Z
|
temboo/core/Library/PagerDuty/Incidents/__init__.py
|
jordanemedlock/psychtruths
|
52e09033ade9608bd5143129f8a1bfac22d634dd
|
[
"Apache-2.0"
] | null | null | null |
temboo/core/Library/PagerDuty/Incidents/__init__.py
|
jordanemedlock/psychtruths
|
52e09033ade9608bd5143129f8a1bfac22d634dd
|
[
"Apache-2.0"
] | 8
|
2016-06-14T06:01:11.000Z
|
2020-04-22T09:21:44.000Z
|
from temboo.Library.PagerDuty.Incidents.AcknowledgeIncident import AcknowledgeIncident, AcknowledgeIncidentInputSet, AcknowledgeIncidentResultSet, AcknowledgeIncidentChoreographyExecution
from temboo.Library.PagerDuty.Incidents.CountIncidents import CountIncidents, CountIncidentsInputSet, CountIncidentsResultSet, CountIncidentsChoreographyExecution
from temboo.Library.PagerDuty.Incidents.GetIncident import GetIncident, GetIncidentInputSet, GetIncidentResultSet, GetIncidentChoreographyExecution
from temboo.Library.PagerDuty.Incidents.ListIncidents import ListIncidents, ListIncidentsInputSet, ListIncidentsResultSet, ListIncidentsChoreographyExecution
from temboo.Library.PagerDuty.Incidents.ReassignIncident import ReassignIncident, ReassignIncidentInputSet, ReassignIncidentResultSet, ReassignIncidentChoreographyExecution
from temboo.Library.PagerDuty.Incidents.ResolveIncident import ResolveIncident, ResolveIncidentInputSet, ResolveIncidentResultSet, ResolveIncidentChoreographyExecution
from temboo.Library.PagerDuty.Incidents.UpdateIncidents import UpdateIncidents, UpdateIncidentsInputSet, UpdateIncidentsResultSet, UpdateIncidentsChoreographyExecution
| 145.75
| 187
| 0.915952
| 77
| 1,166
| 13.87013
| 0.441558
| 0.065543
| 0.111423
| 0.170412
| 0.229401
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.042024
| 1,166
| 7
| 188
| 166.571429
| 0.956133
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 1
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
edfc46f614aeb441228b2f6603654c77fc5a3242
| 188
|
py
|
Python
|
src/pipeline/main.py
|
domfp13/DataEngineering-DBT
|
637d4675b5d6a708ae99eb31bee3a745d3e64dc1
|
[
"MIT"
] | 1
|
2021-04-02T21:22:19.000Z
|
2021-04-02T21:22:19.000Z
|
src/pipeline/main.py
|
domfp13/DataEngineering-DBT
|
637d4675b5d6a708ae99eb31bee3a745d3e64dc1
|
[
"MIT"
] | null | null | null |
src/pipeline/main.py
|
domfp13/DataEngineering-DBT
|
637d4675b5d6a708ae99eb31bee3a745d3e64dc1
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
# Created by Luis Enrique Fuentes Plata
from __init__ import load_raw_netflix_titles
if __name__ == "__main__":
load_raw_netflix_titles('netflix_titles.csv')
| 23.5
| 49
| 0.75
| 26
| 188
| 4.692308
| 0.769231
| 0.319672
| 0.229508
| 0.327869
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006211
| 0.143617
| 188
| 8
| 49
| 23.5
| 0.751553
| 0.31383
| 0
| 0
| 0
| 0
| 0.204724
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 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
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
b67440d1dd54ac31e31ee777544db0389fcf7e2d
| 6,847
|
py
|
Python
|
tests/unit/test_CXRGBAColor.py
|
docinfosci/canvasxpress-python
|
532a981b04d0f50bbde1852c695117a6220f4589
|
[
"MIT"
] | 4
|
2021-03-18T17:23:40.000Z
|
2022-02-01T19:07:01.000Z
|
tests/unit/test_CXRGBAColor.py
|
docinfosci/canvasxpress-python
|
532a981b04d0f50bbde1852c695117a6220f4589
|
[
"MIT"
] | 8
|
2021-04-30T20:46:57.000Z
|
2022-03-10T07:25:31.000Z
|
tests/unit/test_CXRGBAColor.py
|
docinfosci/canvasxpress-python
|
532a981b04d0f50bbde1852c695117a6220f4589
|
[
"MIT"
] | 1
|
2022-02-03T00:35:14.000Z
|
2022-02-03T00:35:14.000Z
|
import json
from copy import copy, deepcopy
import pytest
from canvasxpress.config.type import CXRGBAColor, CXBool
def test_CXRGBAColor_init():
subject: CXRGBAColor = CXRGBAColor(
label="1",
value={'r': 128, 'g': 128, 'b': 128, 'a': 0.5}
)
assert subject.label == "1"
assert subject.value == {'r': 128, 'g': 128, 'b': 128, 'a': 0.5}
subject: CXRGBAColor = CXRGBAColor(
label="1",
value=None
)
assert subject.label == "1"
assert subject.value == {'r': 0, 'g': 0, 'b': 0, 'a': 1}
with pytest.raises(ValueError):
CXRGBAColor(
label=None,
value={'r': 1, 'g': 1, 'b': 1, 'a': 1}
)
def test_is_color_str():
assert CXRGBAColor.is_color_str("rgba(0,0,0,1)")
assert CXRGBAColor.is_color_str("rgba(0 ,0 ,0 , 1)")
assert not CXRGBAColor.is_color_str("rgba(0 ,0 ,0 , 2)")
assert not CXRGBAColor.is_color_str("rgba(0 ,0 ,0 , q)")
assert not CXRGBAColor.is_color_str("rgba(-1,0,0,1)")
assert not CXRGBAColor.is_color_str("rgba(256,0,0,1)")
assert not CXRGBAColor.is_color_str("rgba(0,0,0)")
assert not CXRGBAColor.is_color_str("fred(0,0,0,1)")
assert not CXRGBAColor.is_color_str({'r': 0, 'g': 0, 'b': 0, 'a': 1})
def test_is_color_list():
assert CXRGBAColor.is_color_list([0,0,0,1])
assert CXRGBAColor.is_color_list([0 ,0 ,0 , 1])
assert not CXRGBAColor.is_color_list([0, 0,])
assert not CXRGBAColor.is_color_list([0, 0, 0, '1'])
assert not CXRGBAColor.is_color_list([0, 0, 0, 2])
assert not CXRGBAColor.is_color_list([0, 0, 0, 1, 7])
assert not CXRGBAColor.is_color_list([-1,0,0,1])
assert not CXRGBAColor.is_color_list([256,0,0,1])
assert not CXRGBAColor.is_color_list("rgba(0,0,0)")
assert not CXRGBAColor.is_color_list("fred(0,0,0,1)")
assert not CXRGBAColor.is_color_list({'r': 0, 'g': 0, 'b': 0, 'a': 1})
def test_is_color_dict():
assert CXRGBAColor.is_color_dict({'r': 0, 'g': 0, 'b': 0, 'a': 1})
assert not CXRGBAColor.is_color_dict({'r': -1, 'g': 0, 'b': 0, 'a': 1})
assert not CXRGBAColor.is_color_dict({'r': 1, 'g': 0, 'b': 0, 'a': -1})
assert not CXRGBAColor.is_color_dict({'r': 0, 'g': 0, 'b': 0, 'q': 1})
assert not CXRGBAColor.is_color_dict({'r': 0, 'g': 0, 'b': 0, 'a': 1, 'q': 1})
assert not CXRGBAColor.is_color_dict({'r': '0', 'g': 0, 'b': 0, 'a': 1})
assert not CXRGBAColor.is_color_dict([0,0,0,1])
assert not CXRGBAColor.is_color_dict("rgba(0,0,0)")
assert not CXRGBAColor.is_color_dict("fred(0,0,0,1)")
def test_CXRGBAColor_label():
subject: CXRGBAColor = CXRGBAColor("1", None)
assert subject.label == "1"
with pytest.raises(AttributeError):
subject: CXRGBAColor = CXRGBAColor("1", None)
subject.label = "2"
def test_CXRGBAColor_value():
subject: CXRGBAColor = CXRGBAColor("1", None)
subject.value = {'r': 1, 'g': 1, 'b': 1, 'a': 1}
assert subject.value == {'r': 1, 'g': 1, 'b': 1, 'a': 1}
subject: CXRGBAColor = CXRGBAColor("1", {'r': 128, 'g': 128, 'b': 128, 'a': 0.5})
subject.value = None
assert subject.value == {'r': 0, 'g': 0, 'b': 0, 'a': 1}
subject: CXRGBAColor = CXRGBAColor("1", None)
subject.value = {'r': 128, 'g': 128, 'b': 128, 'a': 0.5}
assert subject.value == {'r': 128, 'g': 128, 'b': 128, 'a': 0.5}
subject: CXRGBAColor = CXRGBAColor("1", None)
subject.value = CXRGBAColor("a", {'r': 128, 'g': 128, 'b': 128, 'a': 0.5})
assert subject.value == {'r': 128, 'g': 128, 'b': 128, 'a': 0.5}
subject: CXRGBAColor = CXRGBAColor("1", None)
subject.value = "rgba(128, 128, 128, 0.5)"
assert subject.value == {'r': 128, 'g': 128, 'b': 128, 'a': 0.5}
subject: CXRGBAColor = CXRGBAColor("1", None)
subject.value = [128, 128, 128, 0.5]
assert subject.value == {'r': 128, 'g': 128, 'b': 128, 'a': 0.5}
with pytest.raises(TypeError):
subject: CXRGBAColor = CXRGBAColor('1', None)
subject.value = 2
with pytest.raises(ValueError):
subject: CXRGBAColor = CXRGBAColor('1', None)
subject.value = "rgba(1,1,1,q)"
with pytest.raises(ValueError):
subject: CXRGBAColor = CXRGBAColor('1', None)
subject.value = [0, 0, 0, 1, 7]
with pytest.raises(ValueError):
subject: CXRGBAColor = CXRGBAColor('1', None)
subject.value = {'q': 128, 'y': 128, 'b': '128', 'a': 0.5}
def test_CXRGBAColor_copy():
subject: CXRGBAColor = CXRGBAColor("1", {'r': 128, 'g': 128, 'b': 128, 'a': 0.5})
assert subject == copy(subject)
def test_CXRGBAColor_deepcopy():
subject: CXRGBAColor = CXRGBAColor("1", {'r': 128, 'g': 128, 'b': 128, 'a': 0.5})
assert subject == deepcopy(subject)
def test_CXRGBAColor_str():
subject: CXRGBAColor = CXRGBAColor("1", {'r': 128, 'g': 128, 'b': 128, 'a': 0.5})
assert str(subject) == json.dumps({subject.label: "rgba(128,128,128,0.5)"})
def test_CXRGBAColor_repr():
subject: CXRGBAColor = CXRGBAColor("1", {'r': 128, 'g': 128, 'b': 128, 'a': 0.5})
subject_repr = repr(subject)
assert isinstance(subject_repr, str)
assert subject == eval(subject_repr)
def test_CXRGBAColor_equality():
subject1: CXRGBAColor = CXRGBAColor("1", None)
subject2: CXRGBAColor = CXRGBAColor("1", None)
assert subject1 == subject2
assert not subject1 < subject2
assert not subject1 > subject2
subject1: CXRGBAColor = CXRGBAColor("1", {'r': 1, 'g': 1, 'b': 1, 'a': 1})
subject2: CXRGBAColor = CXRGBAColor("1", {'r': 1, 'g': 1, 'b': 1, 'a': 1})
assert subject1 == subject2
assert not subject1 < subject2
assert not subject1 > subject2
subject1: CXRGBAColor = CXRGBAColor("1", {'r': 1, 'g': 1, 'b': 1, 'a': 1})
subject2: CXRGBAColor = CXRGBAColor("1", {'r': 255, 'g': 255, 'b': 255, 'a': 1})
assert subject1 != subject2
assert subject1 < subject2
assert not subject1 > subject2
subject1: CXRGBAColor = CXRGBAColor("1", None)
subject2: CXRGBAColor = CXRGBAColor("2", None)
assert subject1 != subject2
assert subject1 < subject2
assert not subject1 > subject2
assert subject2 > subject1
subject1: CXRGBAColor = CXRGBAColor("1", {'r': 128, 'g': 128, 'b': 128, 'a': 0.5})
subject2: CXRGBAColor = CXRGBAColor("1", {'r': 1, 'g': 1, 'b': 1, 'a': 1})
assert subject1 != subject2
assert subject1 < subject2
assert not subject1 > subject2
subject1: CXRGBAColor = CXRGBAColor("1", {'r': 128, 'g': 128, 'b': 128, 'a': 0.5})
subject2: CXRGBAColor = None
assert subject1 != subject2
assert not subject1 < subject2
assert subject1 > subject2
subject1: CXRGBAColor = CXRGBAColor("1", {'r': 128, 'g': 128, 'b': 128, 'a': 0.5})
subject2: CXBool = CXBool("1", False)
assert subject1 != subject2
assert not subject1 < subject2
assert subject1 > subject2
| 37.010811
| 86
| 0.605959
| 993
| 6,847
| 4.091641
| 0.054381
| 0.019198
| 0.128477
| 0.129953
| 0.857741
| 0.830175
| 0.78981
| 0.769136
| 0.71745
| 0.66035
| 0
| 0.089003
| 0.205784
| 6,847
| 184
| 87
| 37.211957
| 0.658146
| 0
| 0
| 0.478873
| 0
| 0
| 0.05915
| 0.003067
| 0
| 0
| 0
| 0
| 0.471831
| 1
| 0.077465
| false
| 0
| 0.028169
| 0
| 0.105634
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
b6a301f255eb43199d0125d35d99576b52cd9f25
| 23,390
|
py
|
Python
|
similarweb/base.py
|
audiencepi/SimilarWeb-Python
|
4bf5e2315815cb622bd64714573f8df29339e615
|
[
"MIT"
] | 4
|
2019-04-20T16:32:46.000Z
|
2021-10-30T14:14:25.000Z
|
similarweb/base.py
|
audiencepi/SimilarWeb-Python
|
4bf5e2315815cb622bd64714573f8df29339e615
|
[
"MIT"
] | null | null | null |
similarweb/base.py
|
audiencepi/SimilarWeb-Python
|
4bf5e2315815cb622bd64714573f8df29339e615
|
[
"MIT"
] | 3
|
2017-10-11T16:04:23.000Z
|
2020-10-26T15:04:09.000Z
|
import requests
import json
from abc import ABCMeta, abstractmethod
from similarweb.exceptions import InvalidResponseException, InvalidEndpointException
from similarweb import utils
class SimilarWeb(object):
__metaclass__ = ABCMeta
def __init__(self, api_key):
"""
Parameters
----------
api_key: string
SimilarWeb API key
"""
self.api_key = api_key
@property
def _base_url(self):
return "http://api.similarweb.com"
@abstractmethod
def params(self):
return
@abstractmethod
def url(self):
return
@abstractmethod
def query(self):
return
class TrafficAPI(SimilarWeb):
def __init__(self, api_key, domain, start_month, end_month,
time_granularity="MONTHLY", main_domain_only=False):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
start_month: string
Start Month in (M-YYYY) format
end_month: string
End Month in (M-YYYY) format
time_granularity: string
Time granularity of report. Can be: Daily, Weekly, Monthly
main_domain_only: boolean
Get metrics on the Main Domain only (i.e. not including subdomains)
"""
self.domain = utils.domain_from_url(domain)
self.start_month = start_month
self.end_month = end_month
self.time_granularity = time_granularity
self.main_domain_only = main_domain_only
super(TrafficAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["start_month"] = self.start_month
params["end_month"] = self.end_month
params["time_granularity"] = self.time_granularity
params["main_domain_only"] = str(self.main_domain_only).lower()
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v1/visits?gr={time_granularity}&start={start_month}"
"&end={end_month}&md={main_domain_only}&Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'Values' not in results:
raise InvalidResponseException(results)
return results['Values']
class RankAndReachAPI(SimilarWeb):
def __init__(self, api_key, domain):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
"""
self.domain = utils.domain_from_url(domain)
super(RankAndReachAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v1/traffic?Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'GlobalRank' not in results:
raise InvalidResponseException(results)
return results
class EngagementAPI(SimilarWeb):
def __init__(self, api_key, endpoint, domain, start_month, end_month,
time_granularity="MONTHLY", main_domain_only=False):
"""
Parameters
----------
api_key: string
SimilarWeb API key
endpoint: string
Endpoint to use. Can be: pageviews, visitduration, bouncerate
domain: string
Domain to query.
start_month: string
Start Month in (M-YYYY) format
end_month: string
End Month in (M-YYYY) format
time_granularity: string
Time granularity of report. Can be: Daily, Weekly, Monthly
main_domain_only: boolean
Get metrics on the Main Domain only (i.e. not including subdomains)
"""
if endpoint not in ["pageviews", "visitduration", "bouncerate"]:
raise InvalidEndpointException("Endpoint must be one of the following values: "
"pageviews, visitduration, bouncerate")
self.endpoint = endpoint
self.domain = utils.domain_from_url(domain)
self.start_month = start_month
self.end_month = end_month
self.time_granularity = time_granularity
self.main_domain_only = main_domain_only
super(EngagementAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["endpoint"] = self.endpoint
params["domain"] = self.domain
params["start_month"] = self.start_month
params["end_month"] = self.end_month
params["time_granularity"] = self.time_granularity
params["main_domain_only"] = str(self.main_domain_only).lower()
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v1/{endpoint}?gr={time_granularity}&start={start_month}"
"&end={end_month}&md={main_domain_only}&Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'Values' not in results:
raise InvalidResponseException(results)
return results['Values']
class SimilarWebsitesAPI(SimilarWeb):
def __init__(self, api_key, domain):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
"""
self.domain = utils.domain_from_url(domain)
super(SimilarWebsitesAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v2/similarsites?Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'SimilarSites' not in results:
raise InvalidResponseException(results)
return results['SimilarSites']
class AlsoVisitedAPI(SimilarWeb):
def __init__(self, api_key, domain):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
"""
self.domain = utils.domain_from_url(domain)
super(AlsoVisitedAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v2/alsovisited?Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'AlsoVisited' not in results:
raise InvalidResponseException(results)
return results['AlsoVisited']
class WebsiteTagsAPI(SimilarWeb):
def __init__(self, api_key, domain):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
"""
self.domain = utils.domain_from_url(domain)
super(WebsiteTagsAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v2/tags?Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'Tags' not in results:
raise InvalidResponseException(results)
return results['Tags']
class WebsiteCategorizationAPI(SimilarWeb):
def __init__(self, api_key, domain):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
"""
self.domain = utils.domain_from_url(domain)
super(WebsiteCategorizationAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v2/category?Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'Category' not in results:
raise InvalidResponseException(results)
return results['Category']
class CategoryRankAPI(SimilarWeb):
def __init__(self, api_key, domain):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
"""
self.domain = utils.domain_from_url(domain)
super(CategoryRankAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v2/CategoryRank?Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'Category' not in results:
raise InvalidResponseException(results)
return results
class TopSitesAPI(SimilarWeb):
def __init__(self, api_key, category=None, country=None):
"""
Parameters
----------
api_key: string
SimilarWeb API key
category: string
If left blank, `All Categories` will be requested.
Use `http://api.similarweb.com/v1/TopSites/categories` to get a list of available categories.
country: string
If left blank, `Worldwide` will be requested.
Use `http://api.similarweb.com/v1/TopSites/countries` to get a list of available categories.
"""
self.category = category
self.country = country
super(TopSitesAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["category"] = self.category if self.category else ""
params["country"] = self.country if self.country else ""
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/v1/TopSites?Format=JSON&country={country}&category={category}"
"&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if '1' not in results:
raise InvalidResponseException(results)
return results
class SocialReferralsAPI(SimilarWeb):
def __init__(self, api_key, domain):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
"""
self.domain = utils.domain_from_url(domain)
super(SocialReferralsAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v1/socialreferringsites?Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'SocialSources' not in results:
raise InvalidResponseException(results)
return results
class SearchKeywordsAPI(SimilarWeb):
def __init__(self, api_key, endpoint, domain, start_month, end_month,
main_domain_only=False, results_page=None):
"""
Parameters
----------
api_key: string
SimilarWeb API key
endpoint: string
Endpoint to use. Can be: orgsearch, paidsearch
domain: string
Domain to query.
start_month: string
Start Month in (M-YYYY) format
end_month: string
End Month in (M-YYYY) format
main_domain_only: boolean
Get metrics on the Main Domain only (i.e. not including subdomains)
results_page: integer
Enter for more than 10 results
"""
if endpoint not in ["orgsearch", "paidsearch", ]:
raise InvalidEndpointException("Endpoint must be one of the following values: "
"orgsearch, paidsearch")
self.domain = utils.domain_from_url(domain)
self.endpoint = endpoint
self.start_month = start_month
self.end_month = end_month
self.main_domain_only = main_domain_only
self.results_page = results_page
super(SearchKeywordsAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["endpoint"] = self.endpoint
params["domain"] = self.domain
params["start_month"] = self.start_month
params["end_month"] = self.end_month
params["main_domain_only"] = str(self.main_domain_only).lower()
params["results_page"] = self.results_page if self.results_page else ""
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v1/{endpoint}?start={start_month}&end={end_month}"
"&md={main_domain_only}&page={results_page}&Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'Data' not in results:
raise InvalidResponseException(results)
return results
class DestinationsAPI(SimilarWeb):
def __init__(self, api_key, domain):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
"""
self.domain = utils.domain_from_url(domain)
super(DestinationsAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v2/leadingdestinationsites?Format=JSON&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'Sites' not in results:
raise InvalidResponseException(results)
return results
class ReferralsAPI(SimilarWeb):
def __init__(self, api_key, domain, start_month, end_month,
main_domain_only=False, results_page=None):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
start_month: string
Start Month in (M-YYYY) format
end_month: string
End Month in (M-YYYY) format
main_domain_only: boolean
Get metrics on the Main Domain only (i.e. not including subdomains)
results_page: integer
Enter for more than 10 results
"""
self.domain = utils.domain_from_url(domain)
self.start_month = start_month
self.end_month = end_month
self.main_domain_only = main_domain_only
self.results_page = results_page
super(ReferralsAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["start_month"] = self.start_month
params["end_month"] = self.end_month
params["main_domain_only"] = str(self.main_domain_only).lower()
params["results_page"] = self.results_page if self.results_page else ""
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v1/referrals?start={start_month}"
"&end={end_month}&md={main_domain_only}&page={results_page}&Format=JSON"
"&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'Data' not in results:
raise InvalidResponseException(results)
return results
class KeywordCompetitorsAPI(SimilarWeb):
def __init__(self, api_key, endpoint, domain, start_month, end_month,
main_domain_only=False, results_page=None):
"""
Parameters
----------
api_key: string
SimilarWeb API key
endpoint: string
Endpoint to use. Can be: orgkwcompetitor, paidkwcompetitor
domain: string
Domain to query.
start_month: string
Start Month in (M-YYYY) format
end_month: string
End Month in (M-YYYY) format
main_domain_only: boolean
Get metrics on the Main Domain only (i.e. not including subdomains)
results_page: integer
Enter for more than 10 results
"""
if endpoint not in ["orgkwcompetitor", "paidkwcompetitor", ]:
raise InvalidEndpointException("Endpoint must be one of the following values: "
"orgkwcompetitor, paidkwcompetitor")
self.domain = utils.domain_from_url(domain)
self.endpoint = endpoint
self.start_month = start_month
self.end_month = end_month
self.main_domain_only = main_domain_only
self.results_page = results_page
super(KeywordCompetitorsAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["endpoint"] = self.endpoint
params["start_month"] = self.start_month
params["end_month"] = self.end_month
params["main_domain_only"] = str(self.main_domain_only).lower()
params["results_page"] = self.results_page if self.results_page else ""
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Site/{domain}/v1/{endpoint}?start={start_month}"
"&end={end_month}&md={main_domain_only}&page={results_page}&Format=JSON"
"&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'Data' not in results:
raise InvalidResponseException(results)
return results
class AppDetailsAPI(SimilarWeb):
def __init__(self, api_key, app_id, app_store_id):
"""
Parameters
----------
api_key: string
SimilarWeb API key
app_id: string
Enter the ID of the app (e.g. "com.yahoo.mobile.client.android.mail")
app_store_id: integer
0 for Google Play Store, 1 for iOS AppStore
"""
self.app_id = app_id
self.app_store_id = app_store_id
super(AppDetailsAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["app_id"] = self.app_id
params["app_store_id"] = self.app_store_id
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Mobile/{app_store_id}/{app_id}/v1/GetAppDetails?Format=JSON"
"&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'Title' not in results:
raise InvalidResponseException(results)
return results
class GoogleAppInstallsAPI(SimilarWeb):
def __init__(self, api_key, app_id):
"""
Parameters
----------
api_key: string
SimilarWeb API key
app_id: string
Enter the ID of the app (e.g. "com.yahoo.mobile.client.android.mail")
"""
self.app_id = app_id
super(GoogleAppInstallsAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["app_id"] = self.app_id
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Mobile/0/{app_id}/v1/GetAppInstalls?Format=JSON"
"&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'InstallsMin' not in results:
raise InvalidResponseException(results)
return results
class RelatedSiteAppsAPI(SimilarWeb):
def __init__(self, api_key, domain, app_store_id):
"""
Parameters
----------
api_key: string
SimilarWeb API key
domain: string
Domain to query.
app_store_id: integer
0 for Google Play Store, 1 for iOS AppStore
"""
self.domain = utils.domain_from_url(domain)
self.app_store_id = app_store_id
super(RelatedSiteAppsAPI, self).__init__(api_key)
@property
def params(self):
params = {}
params["domain"] = self.domain
params["app_store_id"] = self.app_store_id
params["api_key"] = self.api_key
return params
@property
def url(self):
end_url = ("/Mobile/{app_store_id}/{domain}/v1/GetRelatedSiteApps?Format=JSON"
"&UserKey={api_key}".format(**self.params))
return self._base_url + end_url
def query(self):
response = requests.get(self.url)
results = json.loads(response.text)
if 'RelatedApps' not in results:
raise InvalidResponseException(results)
return results['RelatedApps']
| 27.812128
| 116
| 0.597349
| 2,610
| 23,390
| 5.135632
| 0.062452
| 0.055506
| 0.041779
| 0.0188
| 0.867204
| 0.861907
| 0.859893
| 0.84997
| 0.817443
| 0.787526
| 0
| 0.001888
| 0.297991
| 23,390
| 840
| 117
| 27.845238
| 0.814434
| 0.166439
| 0
| 0.789954
| 0
| 0
| 0.140588
| 0.075727
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.011416
| 0.009132
| 0.347032
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
fced7d210271c1e01297dccfa5abbdc59a88b29c
| 8,303
|
py
|
Python
|
tema5/function_aproximator/deep.py
|
luguzman/ia-course
|
71cc0eeaa77d6c44ca85067391aeaee40a8fd14b
|
[
"MIT"
] | null | null | null |
tema5/function_aproximator/deep.py
|
luguzman/ia-course
|
71cc0eeaa77d6c44ca85067391aeaee40a8fd14b
|
[
"MIT"
] | null | null | null |
tema5/function_aproximator/deep.py
|
luguzman/ia-course
|
71cc0eeaa77d6c44ca85067391aeaee40a8fd14b
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 8 11:17:49 2018
@author: juangabriel
"""
import torch
class DeepActor(torch.nn.Module):
def __init__(self, input_shape, output_shape, device = torch.device("cpu")):
"""
Una red neuronal convolucional profunda que producirá dos valores continuos (media y desviación típica)
para cada uno de los valores de output_shape. usando el algoritmo de CNN
Se utiliza para representar el papel del actor en A2C.
:param input_shape: Forma de los datos de entrada (representan las observaciones del actor)
:param output_shape: Forma de los datos de salida (representan las acciones que debe producir el actor)
:param device: Donde se almacena y opera la red neuronal (CPU vs CUDA).
"""
super(DeepActor, self).__init__()
self.device = device
self.layer1 = torch.nn.Sequential(torch.nn.Conv2d(input_shape[2], 32, 8, stride = 4, padding = 0),
torch.nn.ReLU())
self.layer2 = torch.nn.Sequential(torch.nn.Conv2d(32, 64, 3, stride = 2, padding = 0),
torch.nn.ReLU())
self.layer3 = torch.nn.Sequential(torch.nn.Conv2d(64, 64, 3, stride = 1, padding = 0),
torch.nn.ReLU())
self.layer4 = torch.nn.Sequential(torch.nn.Linear(64 * 7 * 7, 512),
torch.nn.ReLU())
self.actor_mu = torch.nn.Linear(512, output_shape)
self.actor_sigma = torch.nn.Linear(512, output_shape)
def forward(self, x):
"""
Dada el nuevo dato que obtiene el actor, calculamos la media y la desviación típica
:param x: observación
:return: Media (mu) y Desviación Estándar (sigma) para una política gaussiana
"""
x.require_grad_()
x = x.to(self.device)
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
x = x.view(x.shape[0], -1)
x = self.layer4(x)
mu = self.actor_mu(x)
sigma = self.actor_sigma(x)
return mu, sigma
class DeepDiscreteActor(torch.nn.Module):
def __init__(self, input_shape, output_shape, device = torch.device("cpu")):
"""
Una red neorunal convolucional profunda que utilizará una función logística para discriminar
la acción del espacio de acciones discreto usando una CNN.
Se utiliza para representar el papel del actor en A2C.
:param input_shape: Forma de los datos de entrada (representan las observaciones del actor)
:param output_shape: Forma de los datos de salida (representan las acciones que debe producir el actor)
:param device: Donde se almacena y opera la red neuronal (CPU vs CUDA).
"""
#suponieindo una entrada de 84
super(DeepDiscreteActor, self).__init__()
self.device = device
self.layer1 = torch.nn.Sequential(torch.nn.Conv2d(input_shape[2], 32, 8, stride = 4, padding = 0),
torch.nn.ReLU())
self.layer2 = torch.nn.Sequential(torch.nn.Conv2d(32, 64, 3, stride = 2, padding = 0),
torch.nn.ReLU())
self.layer3 = torch.nn.Sequential(torch.nn.Conv2d(64, 64, 3, stride = 1, padding = 0),
torch.nn.ReLU())
self.layer4 = torch.nn.Sequential(torch.nn.Linear(64 * 7 * 7, 512),
torch.nn.ReLU())
self.actor_logits = torch.nn.Linear(512, output_shape)
def forward(self, x):
"""
Dada el nuevo dato que obtiene el actor, calculamos la acción con la función logit
:param x: observación
:return: logits según la política del agente
"""
x.require_grad_()
x = x.to(self.device)
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
x = x.view(x.shape[0], -1)
x = self.layer4(x)
logits = self.actor_logits(x)
return logits
class DeepCritic(torch.nn.Module):
def __init__(self, input_shape, output_shape = 1, device = torch.device("cpu")):
"""
Una red neorunal convolucional profunda que produce un valor contínuo.
Se utiliza para representar el papel del crítico en A2C.
Estima el valor de la observación / estado actual
:param input_shape: Forma de los datos de entrada (representan las observaciones del actor)
:param output_shape: Forma de los datos de salida (representan el feedback que debe producir el crítico, suele ser un solo valor)
:param device: Donde se almacena y opera la red neuronal (CPU vs CUDA).
"""
super(DeepCritic, self).__init__()
self.device = device
self.layer1 = torch.nn.Sequential(torch.nn.Conv2d(input_shape[2], 32, 8, stride = 4, padding = 0),
torch.nn.ReLU())
self.layer2 = torch.nn.Sequential(torch.nn.Conv2d(32, 64, 3, stride = 2, padding = 0),
torch.nn.ReLU())
self.layer3 = torch.nn.Sequential(torch.nn.Conv2d(64, 64, 3, stride = 1, padding = 0),
torch.nn.ReLU())
self.layer4 = torch.nn.Sequential(torch.nn.Linear(64 * 7 * 7, 512),
torch.nn.ReLU())
self.critic = torch.nn.Linear(512, output_shape)
def forward(self, x):
"""
A partir de los datos de entrada, devolvemos el valor estimado de salida como críticos
:param x: observación
:return: logits según la política del agente
"""
x.require_grad_()
x = x.to(self.device)
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
x = x.view(x.shape[0], -1)
x = self.layer4(x)
critic = self.critic(x)
return critic
class DeepActorCritic(torch.nn.Module):
def __init__(self, input_shape, actor_shape, critic_shape, device = torch.device("cpu")):
"""
Una red neorunal convolucional profunda que se utiliza para representar tanto al actor como al crítico en el algoritmo A2C.
:param input_shape: Forma de los datos de entrada (representan las observaciones del actor)
:param actor_shape: Forma de los datos de salida del actor (representan las acciones que debe producir el actor)
:param critic_shape: Forma de los datos de salida del crítico (representan el feedback que debe producir el crítico, suele ser un solo valor)
:param device: Donde se almacena y opera la red neuronal (CPU vs CUDA).
"""
super(DeepActorCritic, self).__init__()
self.device = device
self.layer1 = torch.nn.Sequential(torch.nn.Conv2d(input_shape[2], 32, 8, stride = 4, padding = 0),
torch.nn.ReLU())
self.layer2 = torch.nn.Sequential(torch.nn.Conv2d(32, 64, 3, stride = 2, padding = 0),
torch.nn.ReLU())
self.layer3 = torch.nn.Sequential(torch.nn.Conv2d(64, 64, 3, stride = 1, padding = 0),
torch.nn.ReLU())
self.layer4 = torch.nn.Sequential(torch.nn.Linear(64 * 7 * 7, 512),
torch.nn.ReLU())
self.actor_mu = torch.nn.Linear(512, actor_shape)
self.actor_sigma = torch.nn.Linear(512, actor_shape)
self.critic = torch.nn.Linear(512, critic_shape)
def forward(self, x):
"""
A partir de los datos de entrada, devolvemos el valor estimado de salida para el actor y el crítico
:param x: observación
:return: logits según la política del agente
"""
x.require_grad_()
x = x.to(self.device)
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
x = x.view(x.shape[0], -1)
x = self.layer4(x)
actor_mu = self.actor_mu(x)
actor_sigma = self.actor_sigma(x)
critic = self.critic(x)
return actor_mu, actor_sigma, critic
| 47.718391
| 149
| 0.580634
| 1,086
| 8,303
| 4.361878
| 0.143646
| 0.087186
| 0.05742
| 0.074309
| 0.812328
| 0.798185
| 0.781085
| 0.769897
| 0.738231
| 0.727887
| 0
| 0.035588
| 0.319764
| 8,303
| 174
| 150
| 47.718391
| 0.803116
| 0.334457
| 0
| 0.727273
| 0
| 0
| 0.002345
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.080808
| false
| 0
| 0.010101
| 0
| 0.171717
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
bf7be829cbd97a16c845b109ffdb8002402baa5e
| 234
|
py
|
Python
|
utils/ascii.py
|
Vaansh/Zendesk-Ticket-Viewer
|
bb836c19432f51426dc99de9e33fd762da7f263c
|
[
"MIT"
] | null | null | null |
utils/ascii.py
|
Vaansh/Zendesk-Ticket-Viewer
|
bb836c19432f51426dc99de9e33fd762da7f263c
|
[
"MIT"
] | null | null | null |
utils/ascii.py
|
Vaansh/Zendesk-Ticket-Viewer
|
bb836c19432f51426dc99de9e33fd762da7f263c
|
[
"MIT"
] | null | null | null |
import utils.helpers as helpers
def logo() -> str:
return helpers.get_string_from_text_file("utils/data/logo.txt")
def application_name() -> str:
return helpers.get_string_from_text_file("utils/data/application_name.txt")
| 23.4
| 79
| 0.764957
| 35
| 234
| 4.828571
| 0.485714
| 0.106509
| 0.189349
| 0.224852
| 0.544379
| 0.544379
| 0.544379
| 0.544379
| 0.544379
| 0.544379
| 0
| 0
| 0.119658
| 234
| 9
| 80
| 26
| 0.820388
| 0
| 0
| 0
| 0
| 0
| 0.213675
| 0.132479
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| true
| 0
| 0.2
| 0.4
| 1
| 0
| 0
| 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
| 1
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 7
|
bfcec866d5b9f581254d00f38baaab07922191df
| 13,007
|
py
|
Python
|
deucevalere/tests/test_client_valere_validate_metadata.py
|
BenjamenMeyer/deuce-valere
|
e9ba7d96825e81e51ddd5f99f1464990969a8f07
|
[
"Apache-2.0"
] | null | null | null |
deucevalere/tests/test_client_valere_validate_metadata.py
|
BenjamenMeyer/deuce-valere
|
e9ba7d96825e81e51ddd5f99f1464990969a8f07
|
[
"Apache-2.0"
] | null | null | null |
deucevalere/tests/test_client_valere_validate_metadata.py
|
BenjamenMeyer/deuce-valere
|
e9ba7d96825e81e51ddd5f99f1464990969a8f07
|
[
"Apache-2.0"
] | null | null | null |
"""
Deuce Valere - Tests - Client - Valere - Validate Metadata
"""
import functools
import json
import mock
from deuceclient.tests import *
import httpretty
from deucevalere.tests import *
from deucevalere.tests.client_base import TestValereClientBase
from deucevalere.tests.client_base import calculate_ref_modified
@httpretty.activate
class TestValereClientValidateMetadata(TestValereClientBase):
def setUp(self):
super().setUp()
self.project_id = create_project_name()
self.vault_id = create_vault_name()
self.generate_blocks(count=20)
def tearDown(self):
super().tearDown()
def test_validate_metadata_no_blocks(self):
self.secondary_setup(manager_start=None,
manager_end=None)
def metadata_listing_callback(request, uri, headers):
return (200, headers, json.dumps([]))
url = get_blocks_url(self.apihost, self.vault.vault_id)
httpretty.register_uri(httpretty.GET,
url,
body=metadata_listing_callback)
self.client.validate_metadata()
self.assertEqual(len(self.manager.metadata.current), 0)
self.assertEqual(len(self.manager.metadata.expired), 0)
self.assertIsNone(self.manager.metadata.deleted, None)
def test_validate_metadata_missing_blocks(self):
self.secondary_setup(manager_start=None,
manager_end=None)
def metadata_listing_callback(request, uri, headers):
return self.metadata_block_listing_success(request,
uri,
headers)
def metadata_head_callback(request, uri, headers):
return self.metadata_block_head_missing(request,
uri,
headers)
url = get_blocks_url(self.apihost, self.vault.vault_id)
httpretty.register_uri(httpretty.GET,
url,
body=metadata_listing_callback)
httpretty.register_uri(httpretty.HEAD,
self.get_metadata_block_pattern_matcher(),
body=metadata_head_callback)
self.client.get_block_list()
self.assertEqual(len(self.manager.metadata.current),
len(self.meta_data))
self.client.validate_metadata()
self.assertEqual(len(self.manager.metadata.current),
len(self.meta_data))
self.assertNotEqual(self.manager.missing_counter.count, 0)
self.assertEqual(self.manager.missing_counter.count,
len(self.meta_data))
self.assertIsNone(self.manager.metadata.deleted, None)
def test_validate_metadata_no_expiration_existing_current(self):
self.secondary_setup(manager_start=None,
manager_end=None)
def metadata_listing_callback(request, uri, headers):
return self.metadata_block_listing_success(request,
uri,
headers)
def metadata_head_callback(request, uri, headers):
return self.metadata_block_head_success(request,
uri,
headers)
url = get_blocks_url(self.apihost, self.vault.vault_id)
httpretty.register_uri(httpretty.GET,
url,
body=metadata_listing_callback)
httpretty.register_uri(httpretty.HEAD,
self.get_metadata_block_pattern_matcher(),
body=metadata_head_callback)
self.client.get_block_list()
self.client.validate_metadata()
self.assertEqual(len(self.manager.metadata.current),
len(self.meta_data))
self.assertEqual(len(self.manager.metadata.expired), 0)
self.assertIsNone(self.manager.metadata.deleted, None)
def test_validate_metadata_no_expiration_existing_expired(self):
self.secondary_setup(manager_start=None,
manager_end=None)
def metadata_listing_callback(request, uri, headers):
return self.metadata_block_listing_success(request,
uri,
headers)
def metadata_head_callback(request, uri, headers):
return self.metadata_block_head_success(request,
uri,
headers)
url = get_blocks_url(self.apihost, self.vault.vault_id)
httpretty.register_uri(httpretty.GET,
url,
body=metadata_listing_callback)
httpretty.register_uri(httpretty.HEAD,
self.get_metadata_block_pattern_matcher(),
body=metadata_head_callback)
self.manager.metadata.expired = []
self.client.validate_metadata()
self.assertEqual(len(self.manager.metadata.current),
len(self.meta_data))
self.assertEqual(len(self.manager.metadata.expired), 0)
self.assertIsNone(self.manager.metadata.deleted, None)
def test_validate_metadata_no_expiration_exception_on_block_heading(self):
self.secondary_setup(manager_start=None,
manager_end=None)
def metadata_listing_callback(request, uri, headers):
return self.metadata_block_listing_success(request,
uri,
headers)
def metadata_head_callback(request, uri, headers):
return self.metadata_block_head_success(request,
uri,
headers)
url = get_blocks_url(self.apihost, self.vault.vault_id)
httpretty.register_uri(httpretty.GET,
url,
body=metadata_listing_callback)
httpretty.register_uri(httpretty.HEAD,
self.get_metadata_block_pattern_matcher(),
body=metadata_head_callback)
with mock.patch(
'deuceclient.client.deuce.DeuceClient.HeadBlock') as mock_dc:
mock_dc.side_effect = RuntimeError('mock exception')
self.client.validate_metadata()
def test_validate_metadata_no_expiration(self):
self.secondary_setup(manager_start=None,
manager_end=None)
def metadata_listing_callback(request, uri, headers):
return self.metadata_block_listing_success(request,
uri,
headers)
def metadata_head_callback(request, uri, headers):
return self.metadata_block_head_success(request,
uri,
headers)
url = get_blocks_url(self.apihost, self.vault.vault_id)
httpretty.register_uri(httpretty.GET,
url,
body=metadata_listing_callback)
httpretty.register_uri(httpretty.HEAD,
self.get_metadata_block_pattern_matcher(),
body=metadata_head_callback)
self.client.validate_metadata()
self.assertEqual(len(self.manager.metadata.current),
len(self.meta_data))
self.assertEqual(len(self.manager.metadata.expired), 0)
self.assertIsNone(self.manager.metadata.deleted, None)
def test_validate_metadata_no_expiration_some_zero_refs(self):
self.secondary_setup(manager_start=None,
manager_end=None)
def metadata_listing_callback(request, uri, headers):
return self.metadata_block_listing_success(request,
uri,
headers)
def metadata_head_callback(request, uri, headers):
return self.metadata_block_head_success(request,
uri,
headers)
url = get_blocks_url(self.apihost, self.vault.vault_id)
httpretty.register_uri(httpretty.GET,
url,
body=metadata_listing_callback)
httpretty.register_uri(httpretty.HEAD,
self.get_metadata_block_pattern_matcher(),
body=metadata_head_callback)
def __min_max(a, b):
return max(min(a, b), b)
key_set = sorted(
list(self.meta_data.keys()))[0:__min_max(len(self.meta_data), 10)]
for key in key_set:
self.meta_data[key].ref_count = 0
self.client.validate_metadata()
self.assertEqual(len(self.manager.metadata.current),
len(self.meta_data))
self.assertEqual(len(self.manager.metadata.expired), 0)
self.assertIsNone(self.manager.metadata.deleted, None)
def test_validate_metadata_expiration_1min_some_zero_refs(self):
self.secondary_setup(manager_start=None,
manager_end=None)
def metadata_listing_callback(request, uri, headers):
return self.metadata_block_listing_success(request,
uri,
headers)
def metadata_head_callback(request, uri, headers):
return self.metadata_block_head_success(request,
uri,
headers)
url = get_blocks_url(self.apihost, self.vault.vault_id)
httpretty.register_uri(httpretty.GET,
url,
body=metadata_listing_callback)
httpretty.register_uri(httpretty.HEAD,
self.get_metadata_block_pattern_matcher(),
body=metadata_head_callback)
def __min_max(a, b):
return max(min(a, b), b)
check_count = self.guarantee_expired(expired_count=10,
expired_age=datetime.timedelta(
minutes=1))
self.client.validate_metadata()
self.assertEqual(len(self.manager.metadata.current),
(len(self.meta_data) - check_count))
self.assertEqual(len(self.manager.metadata.expired), check_count)
self.assertIsNone(self.manager.metadata.deleted, None)
def test_validate_metadata_expiration_existing_in_expirations(self):
self.secondary_setup(manager_start=None,
manager_end=None)
def metadata_listing_callback(request, uri, headers):
return self.metadata_block_listing_success(request,
uri,
headers)
def metadata_head_callback(request, uri, headers):
return self.metadata_block_head_success(request,
uri,
headers)
url = get_blocks_url(self.apihost, self.vault.vault_id)
httpretty.register_uri(httpretty.GET,
url,
body=metadata_listing_callback)
httpretty.register_uri(httpretty.HEAD,
self.get_metadata_block_pattern_matcher(),
body=metadata_head_callback)
def __min_max(a, b):
return max(min(a, b), b)
check_count = self.guarantee_expired(expired_count=10,
expired_age=datetime.timedelta(
minutes=1))
self.client.validate_metadata()
self.assertEqual(len(self.manager.metadata.current),
(len(self.meta_data) - check_count))
self.assertEqual(len(self.manager.metadata.expired), check_count)
self.assertIsNone(self.manager.metadata.deleted, None)
| 42.368078
| 78
| 0.538249
| 1,189
| 13,007
| 5.603028
| 0.092515
| 0.049535
| 0.084209
| 0.063795
| 0.88547
| 0.870459
| 0.854398
| 0.854398
| 0.854398
| 0.854398
| 0
| 0.002911
| 0.392481
| 13,007
| 306
| 79
| 42.506536
| 0.840167
| 0.004459
| 0
| 0.834746
| 0
| 0
| 0.004636
| 0.003555
| 0
| 0
| 0
| 0
| 0.110169
| 1
| 0.131356
| false
| 0
| 0.033898
| 0.084746
| 0.254237
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
449b1e5a31a1161c5dd68ca2464186bb19046e90
| 1,007
|
py
|
Python
|
Level2/Lessons12980/gamjapark.py
|
StudyForCoding/ProgrammersLevel
|
dc957b1c02cc4383a93b8cbf3d739e6c4d88aa25
|
[
"MIT"
] | null | null | null |
Level2/Lessons12980/gamjapark.py
|
StudyForCoding/ProgrammersLevel
|
dc957b1c02cc4383a93b8cbf3d739e6c4d88aa25
|
[
"MIT"
] | null | null | null |
Level2/Lessons12980/gamjapark.py
|
StudyForCoding/ProgrammersLevel
|
dc957b1c02cc4383a93b8cbf3d739e6c4d88aa25
|
[
"MIT"
] | 1
|
2021-04-05T07:35:59.000Z
|
2021-04-05T07:35:59.000Z
|
# 점프와 순간이동
def solution(n):
ans = 0
while n > 0:
if n % 2 != 0:
ans+= 1
n //= 2
return ans
'''
채점을 시작합니다.
정확성 테스트
테스트 1 〉 통과 (0.00ms, 10.2MB)
테스트 2 〉 통과 (0.00ms, 10.1MB)
테스트 3 〉 통과 (0.00ms, 10.2MB)
테스트 4 〉 통과 (0.00ms, 10.2MB)
테스트 5 〉 통과 (0.01ms, 10.2MB)
테스트 6 〉 통과 (0.00ms, 10.2MB)
테스트 7 〉 통과 (0.00ms, 10.3MB)
테스트 8 〉 통과 (0.00ms, 10.3MB)
테스트 9 〉 통과 (0.01ms, 10.1MB)
테스트 10 〉 통과 (0.01ms, 10.2MB)
테스트 11 〉 통과 (0.00ms, 10.2MB)
테스트 12 〉 통과 (0.00ms, 10.2MB)
테스트 13 〉 통과 (0.00ms, 10.2MB)
테스트 14 〉 통과 (0.01ms, 10.1MB)
테스트 15 〉 통과 (0.00ms, 10.1MB)
테스트 16 〉 통과 (0.00ms, 10.2MB)
테스트 17 〉 통과 (0.00ms, 10.2MB)
테스트 18 〉 통과 (0.00ms, 10.2MB)
효율성 테스트
테스트 1 〉 통과 (0.01ms, 10.2MB)
테스트 2 〉 통과 (0.01ms, 10.2MB)
테스트 3 〉 통과 (0.01ms, 10.2MB)
테스트 4 〉 통과 (0.01ms, 10.2MB)
테스트 5 〉 통과 (0.01ms, 10.2MB)
테스트 6 〉 통과 (0.01ms, 10.1MB)
테스트 7 〉 통과 (0.01ms, 10.2MB)
테스트 8 〉 통과 (0.01ms, 10.2MB)
테스트 9 〉 통과 (0.01ms, 10.2MB)
테스트 10 〉 통과 (0.01ms, 10.3MB)
채점 결과
정확성: 60.0
효율성: 40.0
합계: 100.0 / 100.0
'''
| 21.425532
| 28
| 0.550149
| 263
| 1,007
| 2.212928
| 0.174905
| 0.14433
| 0.19244
| 0.19244
| 0.812715
| 0.802406
| 0.756014
| 0.103093
| 0.103093
| 0.103093
| 0
| 0.300133
| 0.252234
| 1,007
| 46
| 29
| 21.891304
| 0.435591
| 0.007944
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0
| 0
| 0.285714
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
44fc5c74323f2aa700807512f25fbcd5d5860605
| 1,194
|
py
|
Python
|
prediction_models/reg_regression.py
|
MrHuff/general_ds_pipeline
|
c11440d7e54329931d3b1a4cb5b7f1c855a208cb
|
[
"MIT"
] | null | null | null |
prediction_models/reg_regression.py
|
MrHuff/general_ds_pipeline
|
c11440d7e54329931d3b1a4cb5b7f1c855a208cb
|
[
"MIT"
] | null | null | null |
prediction_models/reg_regression.py
|
MrHuff/general_ds_pipeline
|
c11440d7e54329931d3b1a4cb5b7f1c855a208cb
|
[
"MIT"
] | null | null | null |
from sklearn.linear_model import Ridge,Lasso,ElasticNet
from utils.other import calc_r2
class ridge_regression():
def __init__(self,X_tr,Y_tr):
self.X_tr = X_tr
self.Y_tr = Y_tr
def fit(self,hparams):
self.model = Ridge(alpha=hparams['alpha'])
self.model.fit(self.X_tr, self.Y_tr)
def evaluate(self,X_val,Y_val):
y_pred = self.model.predict(X_val)
r2 = calc_r2(y_pred,Y_val)
return r2
class lasso_regression():
def __init__(self,X_tr,Y_tr):
self.X_tr = X_tr
self.Y_tr = Y_tr
def fit(self,hparams):
self.model = Lasso(alpha=hparams['alpha'])
self.model.fit(self.X_tr, self.Y_tr)
def evaluate(self,X_val,Y_val):
y_pred = self.model.predict(X_val)
r2 = calc_r2(y_pred,Y_val)
return r2
class elastic_regression():
def __init__(self,X_tr,Y_tr):
self.X_tr = X_tr
self.Y_tr = Y_tr
def fit(self,hparams):
self.model = ElasticNet(alpha=hparams['alpha'])
self.model.fit(self.X_tr, self.Y_tr)
def evaluate(self,X_val,Y_val):
y_pred = self.model.predict(X_val)
r2 = calc_r2(y_pred,Y_val)
return r2
| 29.85
| 55
| 0.632328
| 200
| 1,194
| 3.465
| 0.145
| 0.08658
| 0.090909
| 0.069264
| 0.832612
| 0.832612
| 0.832612
| 0.832612
| 0.832612
| 0.832612
| 0
| 0.011148
| 0.248744
| 1,194
| 40
| 56
| 29.85
| 0.761427
| 0
| 0
| 0.771429
| 0
| 0
| 0.012552
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.257143
| false
| 0
| 0.057143
| 0
| 0.485714
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
78191030b58f41a3df717bf52e30bc9f6373f718
| 2,225
|
py
|
Python
|
tests/messages.py
|
destos/bonfo
|
ac6052769f873c743ca14cffbc6d348b321495b7
|
[
"MIT"
] | null | null | null |
tests/messages.py
|
destos/bonfo
|
ac6052769f873c743ca14cffbc6d348b321495b7
|
[
"MIT"
] | 1
|
2022-03-31T01:54:53.000Z
|
2022-03-31T01:54:53.000Z
|
tests/messages.py
|
destos/bonfo
|
ac6052769f873c743ca14cffbc6d348b321495b7
|
[
"MIT"
] | null | null | null |
# V1.43 messages
# PID advanced
# does not include feedforward data or vbat sag comp or thrust linearization
# pid_advanced = b"$M>2^\x00\x00\x00\x00x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x007\x00\xfa\x00\xd8\x0e\x00\x00\x00\x00\x01\x01\x00\n\x14H\x00H\x00H\x00\x00\x15\x1a\x00(\x14\x00\xc8\x0fd\x04\x00\xb1"
pid_advanced = b'$M>2^\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x007\x00\xfa\x00\xd8\x0e\x00\x00\x00\x00\x01\x01\x00\n\x14H\x00H\x00H\x00\x00\x15\x1a\x00(\x14\x00\xc8\x0fd\x04\x00\xb1'
# PID coefficient
pid = b"$M>\x0fp\x16D\x1f\x1aD\x1f\x1dL\x0457K(\x00\x00G"
fc_version = b"$M>\x03\x03\x01\x0c\x15\x18"
fc_version_2 = b"$M>\x03\x01\x00\x01\x15\x16"
api_version = b"$M>\x03\x01\x00\x01\x15\x16"
status_response = b"$M>\x16e}\x00\x00\x00!\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x1a\x04\x01\x01\x00\x004"
status_ex_response = (
b"$M>\x16\x96}\x00\x00\x00!\x00\x00\x00\x00\x00\x00\x05\x00\x03\x00\x00\x1a\x04\x01\x01\x00\x00\xc4"
)
sensor_alignment = b"$M>\x07~\x01\x01\x00\x01\x00\x01\x01x"
# status_ex_response = (
# b'$M>\x16\x96}\x00\x00\x00!\x00\x00\x00\x00\x00\x00\x05\x00\x03\x04\x00\x1a\x04\x00\x00\x00\x00\xc0'
# )
rc_tuning = b"$M>\x17od\x00FFFA2\x00F\x05\x00dd\x00\x00d\xce\x07\xce\x07\xce\x07\x00\xc7"
rx_tuning2 = (
b"$M>\x02l\x07\xdc\x05\x1a\x04\x00u\x03C\x08\x02\x13\xe2\x04\x00\x00\x00\x00\x00\x00(\x02\x01\x00\x00\x01\x03\x00"
)
board_info = b"$M>J\x04S405\x00\x00\x027\tSTM32F405\nCLRACINGF4\x04CLRA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x02@\x1f\x00\x00\x00\x00\r"
# MSP.ATTITUDE
attitude_response = b"$M>\x06l`\x02\xaa\xff\x0e\x00S"
# MSP.BOXNAMES
box_names_response = (
b"$M>\xfft\x0b\x01ARM;ANGLE;HORIZON;HEADFREE;FAILSAFE;HEADADJ;BEEPER;"
b"OSD DISABLE SW;BLACKBOX;FPV ANGLE MIX;BLACKBOX ERASE (>30s);CAMERA CONTROL 1;"
b"CAMERA CONTROL 2;CAMERA CONTROL 3;FLIP OVER AFTER CRASH;PREARM;VTX PIT MODE;"
b"PARALYZE;USER1;ACRO TRAINER;DISABLE VTX CONTROL;LA"
)
# MSP.BOXIDS
box_names_response = b'$M>\x16w\x00\x01\x02\x06\x1b\x07\r\x13\x1a\x1e\x1f !"#$\'-(/01U'
# MSP.FEATURE_CONFIG
feature_config_response = b'$M>\x04$\x00 D0t'
| 45.408163
| 231
| 0.719101
| 452
| 2,225
| 3.488938
| 0.318584
| 0.395688
| 0.473684
| 0.517438
| 0.446417
| 0.414077
| 0.414077
| 0.374128
| 0.317692
| 0.317692
| 0
| 0.278181
| 0.071011
| 2,225
| 48
| 232
| 46.354167
| 0.484761
| 0.229663
| 0
| 0
| 0
| 0.333333
| 0.773075
| 0.6408
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
7888668d739d548b5a0d66b6038aa3131ce64748
| 6,343
|
py
|
Python
|
Radar.py
|
rickyspy/Pedestrian-Model-Evaluation
|
ae36807d2d9928ee69148a956febedf2b6d76ea8
|
[
"MIT"
] | 3
|
2020-01-21T08:31:08.000Z
|
2022-03-10T19:54:25.000Z
|
Radar.py
|
chraibi/Pedestrian-Model-Evaluation
|
97f75c5e108c1fdcea7beb76e41b36c1af85f738
|
[
"MIT"
] | 2
|
2020-03-06T14:02:08.000Z
|
2021-06-19T05:24:36.000Z
|
Radar.py
|
chraibi/Pedestrian-Model-Evaluation
|
97f75c5e108c1fdcea7beb76e41b36c1af85f738
|
[
"MIT"
] | 3
|
2020-03-06T18:44:18.000Z
|
2022-02-28T14:42:15.000Z
|
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
def RadarFigure(scoreslist, linestylelist, modelnamelist):
# 模板数据和标签
dataLenth = 8
angles = np.linspace((1 / 4) * np.pi, (2 + 1 / 4) * np.pi, dataLenth, endpoint=False)
angles = np.concatenate((angles, [angles[0]]))
labels = np.array(['TS of \n Starting Position', 'Trajectories Pattern', 'Dis of \n Route Length'
, 'Dis of \n Travel Time', 'Speed Choice',
'Fundamental Diagram', 'Direction Choice', 'TS of \n Destination Position'])
# labels = np.array(['TS of \n Starting Position', 'Direction choice', 'Dis of \n Route Length'
# , 'Dis of \n Travel Time', 'Dis of \n Speed',
# 'Speed choice', 'TS of \n Speed', 'TS of \n Destination Position'])
fig = plt.figure(figsize=(3.4, 3.3), dpi=300, linewidth=0.5)
ax = fig.add_subplot(111, polar=True)
plt.rcParams.update({'font.size': 6.5})
plt.grid(linewidth=0.25, linestyle='--')
# # data
# scores = [index_speed, # speed choice
# index_Dis_RL, index_Dis_TT, index_Dis_Speed, # static distribution
# index_TS_OriPoint, index_TS_DestPoint, index_TS_Speed, # dynamic time series
# index_direction] # direction choice
linelist = []
for i in range(len(scoreslist)):
z = [scoreslist[i][4], scoreslist[i][7], scoreslist[i][1], scoreslist[i][2], scoreslist[i][3], scoreslist[i][0],
scoreslist[i][6], scoreslist[i][5]]
data = np.array(z)
data = np.concatenate((data, [data[0]]))
li, = ax.plot(angles, data, linestylelist[i], linewidth=0.75, markersize=1.5) # 线样 1
linelist.append(li)
ax.set_thetagrids(angles * 180 / np.pi, labels, fontproperties="Calibri")
plt.ylim(-0.25, 1.25) # y axis size
plt.yticks(np.arange(0, 1.5, step=0.5))
# plt.yticks.grid = True
# label rotation
plt.gcf().canvas.draw()
# angles1 = np.linspace(0.5*np.pi + (1/8) * np.pi, 0.5*np.pi +(2+1/8) * np.pi, dataLenth, endpoint=False)
angles1 = angles + 0.5 * np.pi
angles1[np.cos(angles1) < 0] = angles1[np.cos(angles1) < 0] + np.pi
angles1 = np.rad2deg(angles1)
labels = []
for label, angle in zip(ax.get_xticklabels(), angles1):
x, y = label.get_position()
lab = ax.text(x, y, label.get_text(), transform=label.get_transform(), ha=label.get_ha(), va=label.get_va())
lab.set_rotation(angle)
labels.append(lab)
ax.set_xticklabels([])
# plt.subplots_adjust(top=0.68,bottom=0.32,left=0.05,right=0.95)
# 设置刻度标签的大小
for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(25)
ax.grid(True)
# 设置legend
plt.legend(handles=linelist, labels=modelnamelist, fontsize=7,
labelspacing=0.075, borderpad=None, edgecolor='white', # borderaxespad = None,
loc=5, bbox_to_anchor=(1.175, -0.06))
# plt.figure(figsize = (2,2))
plt.savefig("radar.jpg")
plt.show()
def SoloRadarFigure(scoreslist, linestylelist, modelnamelist):
for i in range(len(scoreslist)):
# 模板数据和标签
dataLenth = 8
angles = np.linspace((1 / 4) * np.pi, (2 + 1 / 4) * np.pi, dataLenth, endpoint=False)
angles = np.concatenate((angles, [angles[0]]))
labels = np.array(['TS of \n Starting Position', 'Trajectories Pattern', 'Dis of \n Route Length'
, 'Dis of \n Travel Time', 'Speed Choice',
'Fundamental Diagram', 'Direction Choice', 'TS of \n Destination Position'])
fig = plt.figure(figsize=(3.4, 3.3), dpi=300, linewidth=0.5)
ax = fig.add_subplot(111, polar=True)
plt.rcParams.update({'font.size': 6.5})
plt.grid(linewidth=0.25, linestyle='--')
### data
linelist = []
z = [scoreslist[i][4], scoreslist[i][7], scoreslist[i][1], scoreslist[i][2], scoreslist[i][3], scoreslist[i][0],
scoreslist[i][6], scoreslist[i][5]]
data = np.array(z)
data = np.concatenate((data, [data[0]]))
li, = ax.plot(angles, data, linestylelist[i], linewidth=0.75, markersize=1.5) # 线样 1
linelist.append(li)
ax.set_thetagrids(angles * 180 / np.pi, labels, fontproperties="Calibri")
plt.ylim(-0.25, 1.25) # y axis size
plt.yticks(np.arange(0, 1.5, step=0.5))
# plt.yticks.grid = True
# label rotation
plt.gcf().canvas.draw()
# angles1 = np.linspace(0.5*np.pi + (1/8) * np.pi, 0.5*np.pi +(2+1/8) * np.pi, dataLenth, endpoint=False)
angles1 = angles + 0.5 * np.pi
angles1[np.cos(angles1) < 0] = angles1[np.cos(angles1) < 0] + np.pi
angles1 = np.rad2deg(angles1)
labels = []
for label, angle in zip(ax.get_xticklabels(), angles1):
x, y = label.get_position()
lab = ax.text(x, y, label.get_text(), transform=label.get_transform(), ha=label.get_ha(), va=label.get_va())
lab.set_rotation(angle)
labels.append(lab)
ax.set_xticklabels([])
# plt.subplots_adjust(top=0.68,bottom=0.32,left=0.05,right=0.95)
# 设置刻度标签的大小
for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(25)
ax.grid(True)
# 设置legend
# modelnamelist.remove('EXP')
plt.legend(handles=linelist, labels=modelnamelist, fontsize=7,
labelspacing=0.075, borderpad=None, edgecolor='white', # borderaxespad = None,
loc=5, bbox_to_anchor=(1.075, -0.06))
modelnamelist.pop(0)
# plt.figure(figsize = (2,2))
average_score = scoreslist[i][0] * 0.25 + (scoreslist[i][1] + scoreslist[i][2] + scoreslist[i][3]) / 3 * 0.25 \
+ (scoreslist[i][4] + scoreslist[i][5] + scoreslist[i][6]) / 3 * 0.25 + scoreslist[i][7] * 0.25
average_score = int(average_score * 100)
plt.text(-1.5, 0, average_score, size=88, color='gray', alpha=0.8, horizontalalignment='center',
verticalalignment='center')
plt.savefig(r"ResultPics//radar-" + str(i) + ".jpg")
| 45.633094
| 121
| 0.574965
| 855
| 6,343
| 4.207018
| 0.208187
| 0.073395
| 0.00973
| 0.010008
| 0.810398
| 0.788713
| 0.775368
| 0.775368
| 0.765916
| 0.755908
| 0
| 0.052541
| 0.267854
| 6,343
| 138
| 122
| 45.963768
| 0.722007
| 0.178622
| 0
| 0.822222
| 0
| 0
| 0.084062
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.022222
| false
| 0
| 0.033333
| 0
| 0.055556
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
78a5dc13145e1e6b10ba1f289dd839344c35ef17
| 41
|
py
|
Python
|
lib/IPCE/Lib/fepy/codecs_errors.py
|
AustralianDisabilityLimited/MultiversePlatform
|
7e1aad33d48b9e47f3db2ca638cb57592336ddb7
|
[
"MIT"
] | 33
|
2015-02-16T02:52:08.000Z
|
2022-02-18T08:46:32.000Z
|
lib/IPCE/Lib/fepy/codecs_errors.py
|
bensku/MultiversePlatform
|
7e1aad33d48b9e47f3db2ca638cb57592336ddb7
|
[
"MIT"
] | 1
|
2017-09-09T18:50:23.000Z
|
2020-12-29T18:13:56.000Z
|
lib/IPCE/Lib/fepy/codecs_errors.py
|
bensku/MultiversePlatform
|
7e1aad33d48b9e47f3db2ca638cb57592336ddb7
|
[
"MIT"
] | 31
|
2015-02-07T16:20:24.000Z
|
2022-02-23T15:02:43.000Z
|
def install():
import _codecs_errors
| 13.666667
| 25
| 0.731707
| 5
| 41
| 5.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.195122
| 41
| 2
| 26
| 20.5
| 0.848485
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0.5
| 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
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
78c4cc3a0ed904c9e2e09930952f8c7091ef3a74
| 786
|
py
|
Python
|
pytorch_projects/common_pytorch/io_pytorch.py
|
KGMSFT/integral-human-pose
|
d3ad4117ed71c580d2ab17987e15f9b2c3318a3b
|
[
"MIT"
] | 472
|
2018-07-20T04:01:04.000Z
|
2022-01-20T07:28:06.000Z
|
pytorch_projects/common_pytorch/io_pytorch.py
|
KGMSFT/integral-human-pose
|
d3ad4117ed71c580d2ab17987e15f9b2c3318a3b
|
[
"MIT"
] | 44
|
2018-09-17T06:39:13.000Z
|
2021-09-10T06:22:27.000Z
|
pytorch_projects/common_pytorch/io_pytorch.py
|
KGMSFT/integral-human-pose
|
d3ad4117ed71c580d2ab17987e15f9b2c3318a3b
|
[
"MIT"
] | 88
|
2018-07-22T13:10:16.000Z
|
2022-03-21T11:21:38.000Z
|
import torch
def save_model(state, model_prefix, logger, epoch):
file_path = '{}_epoch{}.pth.tar'.format(model_prefix, str(epoch))
torch.save(state, file_path)
logger.info("Write Model into {}".format(file_path))
def save_latest_model(state, model_prefix, logger):
'''
Save a latest ckpt to automatically resume on Philly
'''
file_path = '{}_latest.pth.tar'.format(model_prefix)
torch.save(state, file_path)
logger.info('Write Model into {}'.format(file_path))
def save_lowest_vloss_model(state, model_prefix, logger):
'''
Save a latest ckpt to automatically resume on Philly
'''
file_path = '{}_lowest_vloss.pth.tar'.format(model_prefix)
torch.save(state, file_path)
logger.info('Write Model into {}'.format(file_path))
| 31.44
| 69
| 0.701018
| 111
| 786
| 4.738739
| 0.252252
| 0.136882
| 0.085551
| 0.119772
| 0.851711
| 0.756654
| 0.756654
| 0.756654
| 0.756654
| 0.756654
| 0
| 0
| 0.165394
| 786
| 24
| 70
| 32.75
| 0.801829
| 0.133588
| 0
| 0.384615
| 0
| 0
| 0.177196
| 0.035439
| 0
| 0
| 0
| 0
| 0
| 1
| 0.230769
| false
| 0
| 0.076923
| 0
| 0.307692
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
78c6f423db42c15e253274b099edebd748140397
| 3,885
|
py
|
Python
|
tests/chainermn_tests/iterators_tests/test_synchronized_iterator.py
|
zaltoprofen/chainer
|
3b03f9afc80fd67f65d5e0395ef199e9506b6ee1
|
[
"MIT"
] | 3,705
|
2017-06-01T07:36:12.000Z
|
2022-03-30T10:46:15.000Z
|
tests/chainermn_tests/iterators_tests/test_synchronized_iterator.py
|
hitsgub/chainer
|
20d4d70f5cdacc1f24f243443f5bebc2055c8f8e
|
[
"MIT"
] | 5,998
|
2017-06-01T06:40:17.000Z
|
2022-03-08T01:42:44.000Z
|
tests/chainermn_tests/iterators_tests/test_synchronized_iterator.py
|
hitsgub/chainer
|
20d4d70f5cdacc1f24f243443f5bebc2055c8f8e
|
[
"MIT"
] | 1,150
|
2017-06-02T03:39:46.000Z
|
2022-03-29T02:29:32.000Z
|
import chainer
import chainer.testing
import chainermn
import numpy as np
import pytest
import unittest
class TestSynchronizedIterator(unittest.TestCase):
def setUp(self):
self.communicator = chainermn.create_communicator('naive')
if self.communicator.size < 2:
pytest.skip("This test is for multinode only")
N = 100
self.dataset = np.arange(N).astype(np.float32)
def test_sync(self):
# test the case when datasize is a multiple of batchsize
iterator = chainermn.iterators.create_synchronized_iterator(
chainer.iterators.SerialIterator(
self.dataset, batch_size=4, shuffle=True),
self.communicator)
for e in range(3):
self.assertEqual(e, iterator.epoch)
while True:
batch = np.array(iterator.next(), dtype=np.float32)
if self.communicator.rank == 0:
for rank_from in range(1, self.communicator.size):
_batch = self.communicator.recv(rank_from, tag=0)
chainer.testing.assert_allclose(batch, _batch)
else:
self.communicator.send(batch, dest=0, tag=0)
if iterator.is_new_epoch:
break
def test_sync_frag(self):
# test the case when datasize is not a multiple of batchsize
iterator = chainermn.iterators.create_synchronized_iterator(
chainer.iterators.SerialIterator(
self.dataset, batch_size=7, shuffle=True),
self.communicator)
for e in range(3):
self.assertEqual(e, iterator.epoch)
while True:
batch = np.array(iterator.next(), dtype=np.float32)
if self.communicator.rank == 0:
for rank_from in range(1, self.communicator.size):
_batch = self.communicator.recv(rank_from, tag=0)
chainer.testing.assert_allclose(batch, _batch)
else:
self.communicator.send(batch, dest=0, tag=0)
if iterator.is_new_epoch:
break
def test_sync_no_repeat(self):
iterator = chainermn.iterators.create_synchronized_iterator(
chainer.iterators.SerialIterator(
self.dataset, batch_size=4, shuffle=True, repeat=False),
self.communicator)
for e in range(3):
try:
while True:
batch = np.array(iterator.next(), dtype=np.float32)
if self.communicator.rank == 0:
for rank_from in range(1, self.communicator.size):
_batch = self.communicator.recv(rank_from, tag=0)
chainer.testing.assert_allclose(batch, _batch)
else:
self.communicator.send(batch, dest=0, tag=0)
except StopIteration:
iterator.reset()
def test_sync_no_repeat_frag(self):
iterator = chainermn.iterators.create_synchronized_iterator(
chainer.iterators.SerialIterator(
self.dataset, batch_size=7, shuffle=True, repeat=False),
self.communicator)
for e in range(3):
try:
while True:
batch = np.array(iterator.next(), dtype=np.float32)
if self.communicator.rank == 0:
for rank_from in range(1, self.communicator.size):
_batch = self.communicator.recv(rank_from, tag=0)
chainer.testing.assert_allclose(batch, _batch)
else:
self.communicator.send(batch, dest=0, tag=0)
except StopIteration:
iterator.reset()
| 38.465347
| 77
| 0.559073
| 410
| 3,885
| 5.182927
| 0.204878
| 0.165647
| 0.042353
| 0.060235
| 0.852235
| 0.839529
| 0.839529
| 0.812235
| 0.812235
| 0.812235
| 0
| 0.016827
| 0.357529
| 3,885
| 100
| 78
| 38.85
| 0.834535
| 0.029086
| 0
| 0.740741
| 0
| 0
| 0.009552
| 0
| 0
| 0
| 0
| 0
| 0.074074
| 1
| 0.061728
| false
| 0
| 0.074074
| 0
| 0.148148
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
1550e768382ac6a9d41a5d5f195c664c139f8e82
| 51,685
|
py
|
Python
|
model_train.py
|
hxttkl/KDD_CUP_AutoGraph_AutoEnsemble
|
88b766eb66e33d51ca350b22485bd9839e193ab2
|
[
"MIT"
] | 9
|
2020-08-26T12:37:31.000Z
|
2021-11-01T07:26:28.000Z
|
model_train.py
|
hxttkl/KDD_CUP_AutoGraph_AutoEnsemble
|
88b766eb66e33d51ca350b22485bd9839e193ab2
|
[
"MIT"
] | null | null | null |
model_train.py
|
hxttkl/KDD_CUP_AutoGraph_AutoEnsemble
|
88b766eb66e33d51ca350b22485bd9839e193ab2
|
[
"MIT"
] | 1
|
2020-08-05T08:43:58.000Z
|
2020-08-05T08:43:58.000Z
|
from __future__ import with_statement # Required in 2.5
import torch
import torch.nn.functional as F
from sub_models import GatedGNN
from sub_models import GatedGCN
from sub_models_di import GatedGNN_di
from sub_models_di import GatedGIN_di
from sub_models import GatedGIN
from sub_models import Lin2_APPNP
from sub_models import GCN_APPNP
from sub_models import StopEarly
from sub_models import GIN
from sub_models import GCN
from sub_models import GAT
from sub_models import ARMA
from sub_models import GMM
from sub_models import GraphGNN
from sub_models import MF
from sub_models import AGNN
from sub_models import SAGE
import xgboost as xgb
from xgboost import XGBClassifier
from sklearn.ensemble import RandomForestClassifier
import time
import gc
import signal
from contextlib import contextmanager
class TimeoutException(Exception): pass
def random_weight(num):
weight = torch.rand(num)
weight = weight + 0.5
weight = weight.view(weight.shape[0], 1)
#print(weight)
return weight
@contextmanager
def time_limit(seconds):
def signal_handler(signum, frame):
raise TimeoutException
signal.signal(signal.SIGALRM, signal_handler)
signal.alarm(seconds)
try:
yield
finally:
signal.alarm(0)
def rf_train(train_x,train_y,test_x):
rf1 = RandomForestClassifier(n_jobs=4, n_estimators=600, random_state=123)
rf1.fit(train_x, train_y)
y_pred = rf1.predict_proba(test_x)
return y_pred
def label_train_and_predict(data, sample_mask, val_mask, node_norm,time_control):
data = data.to('cpu')
x = data.feature.cpu().numpy()
train_y = data.y[sample_mask.cpu()].numpy()
train_x = x[sample_mask.cpu(), :]
start = time.time()
try:
with time_limit(time_control.get_remain_time()):
y_pred = rf_train(train_x,train_y,x)
elapsed = (time.time() - start)
print("label训练时间", elapsed)
y_pred = torch.tensor(y_pred, dtype=torch.float)
y_pred = F.log_softmax(y_pred, dim=-1).numpy()
return y_pred
except TimeoutException:
print( "Timed out!")
return None
def gcn_train(data, aggr, sample_mask, val_mask, node_norm, device, time_control,hidden):
num_class = int(max(data.y)) + 1
model = GCN(features_num=data.x.size()[1],num_class=num_class,hidden=hidden,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def gated_train(data, aggr, sample_mask, val_mask, node_norm, device, time_control,hidden,conv_aggr):
num_class = int(max(data.y)) + 1
model = GatedGCN(features_num=data.x.size()[1],num_class=num_class,hidden=hidden,num_layers=2,aggr=conv_aggr)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def graphnn_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control):
num_class = int(max(data.y)) + 1
model = GraphGNN(features_num=data.x.size()[1],num_class=num_class,hidden=64,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def graphnn_di_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control):
num_class = int(max(data.y)) + 1
model = GraphGNN_di(features_num=data.x.size()[1],num_class=num_class,hidden=64,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def mf_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control):
num_class = int(max(data.y)) + 1
model = MF(features_num=data.x.size()[1],num_class=num_class,hidden=32,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def ggnn_di_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control,hidden,conv_aggr):
num_class = int(max(data.y)) + 1
model = GatedGNN_di(features_num=data.x.size()[1],num_class=num_class,hidden=hidden,aggr=conv_aggr)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def ggin_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control,hidden):
num_class = int(max(data.y)) + 1
model = GatedGIN(features_num=data.x.size()[1],num_class=num_class,hidden=hidden)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def ggin_di_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control,hidden):
num_class = int(max(data.y)) + 1
model = GatedGIN_di(features_num=data.x.size()[1],num_class=num_class,hidden=hidden)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def mean_train(data, aggr, sample_mask, val_mask, node_norm, device,
time_control):
num_class = int(max(data.y)) + 1
model = GatedGCN(features_num=data.x.size()[1],num_class=num_class,hidden=64,num_layers=2,aggr='mean',res=True)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def gmm_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control):
num_class = int(max(data.y)) + 1
model = GMM(features_num=data.x.size()[1],num_class=num_class,hidden=48,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def arma_train(data, aggr, sample_mask, val_mask, node_norm, device,
time_control):
num_class = int(max(data.y)) + 1
model = ARMA(features_num=data.x.size()[1], num_class=num_class)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def gin_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control):
num_class = int(max(data.y)) + 1
model = GIN(features_num=data.x.size()[1],num_class=num_class,hidden=64,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def gin_di_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control):
num_class = int(max(data.y)) + 1
model = GIN_di(features_num=data.x.size()[1],num_class=num_class,hidden=48,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def gat_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control):
num_class = int(max(data.y)) + 1
model = GAT(features_num=data.x.size()[1],num_class=num_class,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def appnp_lin_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control):
num_class = data.num_class
model = Lin2_APPNP(features_num=data.x.size()[1],num_class=num_class,hidden=64,K=10,alpha=0.1,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def appnp_gcn_train(data, aggr, sample_mask, val_mask, node_norm, device,time_control,hidden):
num_class = data.num_class
model = GCN_APPNP(features_num=data.x.size()[1],num_class=num_class,hidden=hidden,K=5,alpha=0.2,num_layers=1)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
print(aggr, "开始训练")
t = StopEarly(2)
try:
for epoch in range(1, 501):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
if (node_norm != None):
loss = F.nll_loss((out[sample_mask]),data.y[sample_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[sample_mask]), data.y[sample_mask])
if (epoch % 25 == 0):
model.eval()
out = model(data)
_, pred = out.max(dim=1)
correct = float(pred[val_mask].eq(data.y[val_mask]).sum().item())
acc3 = correct / (val_mask.sum().item())
if (time_control.isTimeToStop() == True):
if (epoch <= 150):
return None
return out.detach().cpu().numpy()
if (t.isTimeToStop(1 - acc3, model, epoch) == True):
end_epoch = epoch
print("早停", end_epoch)
break
loss.backward()
optimizer.step()
model.eval()
with torch.no_grad():
out = model(data)
pred = out.detach().cpu().numpy()
del (model)
del (out)
del (optimizer)
gc.collect()
torch.cuda.empty_cache()
except:
del (model)
del (optimizer)
torch.cuda.empty_cache()
return None
return pred
def ggnn_test(data, device):
num_class = int(max(data.y)) + 1
model = GatedGNN(features_num=data.x.size()[1],num_class=num_class)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
gc.collect()
return elapsed
def ggnn_di_test(data, device,hidden,aggr):
num_class = int(max(data.y)) + 1
model = GatedGNN_di(features_num=data.x.size()[1],num_class=num_class,hidden=hidden,aggr=aggr)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
gc.collect()
return elapsed
def ggin_test(data, device,hidden):
num_class = int(max(data.y)) + 1
model = GatedGIN(features_num=data.x.size()[1],num_class=num_class,hidden=hidden)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
gc.collect()
return elapsed
def ggin_di_test(data, device,hidden):
num_class = int(max(data.y)) + 1
model = GatedGIN_di(features_num=data.x.size()[1],num_class=num_class,hidden=hidden)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
gc.collect()
return elapsed
def mean_test(data, device):
num_class = int(max(data.y)) + 1
model = GatedGCN(features_num=data.x.size()[1],num_class=num_class,hidden=48)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
gc.collect()
return elapsed
def gin_test(data, device):
num_class = int(max(data.y)) + 1
model = GIN(features_num=data.x.size()[1],num_class=num_class, hidden=64,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def gin_di_test(data, device):
num_class = int(max(data.y)) + 1
model = GIN_di(features_num=data.x.size()[1],num_class=num_class, hidden=64,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def gat_test(data, device):
num_class = int(max(data.y)) + 1
model = GAT(features_num=data.x.size()[1],num_class=num_class)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def gcn_test(data, device,hidden=32):
num_class = int(max(data.y)) + 1
model = GCN(features_num=data.x.size()[1],num_class=num_class,hidden=hidden,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def appnp_lin_test(data, device):
num_class = data.num_class
print(2)
model = Lin2_APPNP(features_num=data.x.size()[1],num_class=num_class,hidden=128,K=10,alpha=0.1,num_layers=2)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
#start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def appnp_gcn_test(data, device,hidden):
print(1)
num_class = data.num_class
model = GCN_APPNP(features_num=data.x.size()[1],num_class=num_class,hidden=hidden,K=5,alpha=0.2,num_layers=1)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
#start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def arma_test(data, device):
num_class = data.num_class
model = ARMA(features_num=data.x.size()[1], num_class=num_class)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def gmm_test(data, device):
num_class = data.num_class
model = GMM(features_num=data.x.size()[1], num_class=num_class, hidden=48)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def graphnn_test(data, device):
num_class = data.num_class
model = GraphGNN(features_num=data.x.size()[1],num_class=num_class,hidden=48)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def graphnn_di_test(data, device):
num_class = data.num_class
model = GraphGNN_di(features_num=data.x.size()[1],num_class=num_class,hidden=48)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def mf_test(data, device):
num_class = data.num_class
model = MF(features_num=data.x.size()[1], num_class=num_class, hidden=32)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def agnn_test(data, device):
num_class = data.num_class
model = AGNN(features_num=data.x.size()[1], num_class=num_class, hidden=16)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def sage_test(data, device):
num_class = data.num_class
model = SAGE(features_num=data.x.size()[1], num_class=num_class, hidden=64)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
def gated_test(data, device,hidden,conv_aggr):
num_class = data.num_class
model = GatedGCN(features_num=data.x.size()[1],num_class=num_class,hidden=hidden,num_layers=2,aggr=conv_aggr)
model = model.to(device)
data = data.to(device)
optimizer = torch.optim.Adam(model.parameters(),lr=0.005,weight_decay=0.0005)
start = time.clock()
for epoch in range(1, 2):
model.train()
optimizer.zero_grad()
out = model(data)
loss = None
node_norm = None
if (node_norm != None):
loss = F.nll_loss((out[data.train_mask]),data.y[data.train_mask],reduction='none')
loss = (loss * node_norm).mean()
else:
loss = F.nll_loss((out[data.train_mask]), data.y[data.train_mask])
loss.backward()
optimizer.step()
model.eval()
elapsed = (time.clock() - start)
with torch.no_grad():
del (model)
return elapsed
| 35.352257
| 115
| 0.542382
| 6,496
| 51,685
| 4.169643
| 0.028171
| 0.034557
| 0.042236
| 0.033671
| 0.946799
| 0.939452
| 0.935797
| 0.935797
| 0.934542
| 0.927601
| 0
| 0.021498
| 0.324117
| 51,685
| 1,461
| 116
| 35.376454
| 0.753872
| 0.001316
| 0
| 0.914986
| 0
| 0
| 0.005309
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.028818
| false
| 0.00072
| 0.019452
| 0
| 0.111671
| 0.025937
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
1578ce4d1ca504c7e7f3532f870430539d4b0517
| 1,655
|
py
|
Python
|
python/src/main/python/pyalink/alink/tests/examples/operator/batch/test_mlpc.py
|
wenwei8268/Alink
|
c00702538c95a32403985ebd344eb6aeb81749a7
|
[
"Apache-2.0"
] | null | null | null |
python/src/main/python/pyalink/alink/tests/examples/operator/batch/test_mlpc.py
|
wenwei8268/Alink
|
c00702538c95a32403985ebd344eb6aeb81749a7
|
[
"Apache-2.0"
] | null | null | null |
python/src/main/python/pyalink/alink/tests/examples/operator/batch/test_mlpc.py
|
wenwei8268/Alink
|
c00702538c95a32403985ebd344eb6aeb81749a7
|
[
"Apache-2.0"
] | null | null | null |
import unittest
from pyalink.alink import *
class TestMlpc(unittest.TestCase):
def test_mlpc(self):
URL = "https://alink-test-data.oss-cn-hangzhou.aliyuncs.com/iris.csv"
SCHEMA_STR = "sepal_length double, sepal_width double, petal_length double, petal_width double, category string";
data = CsvSourceBatchOp().setFilePath(URL).setSchemaStr(SCHEMA_STR)
mlpc = MultilayerPerceptronTrainBatchOp() \
.setFeatureCols(["sepal_length", "sepal_width", "petal_length", "petal_width"]) \
.setLabelCol("category") \
.setLayers([4, 5, 3]) \
.setMaxIter(20)
predictor = MultilayerPerceptronPredictBatchOp() \
.setPredictionCol("pred_label") \
.setPredictionDetailCol("pred_detail")
model = mlpc.linkFrom(data)
predictor.linkFrom(model, data).firstN(4).print()
def test_train(self):
URL = "https://alink-test-data.oss-cn-hangzhou.aliyuncs.com/iris.csv"
SCHEMA_STR = "sepal_length double, sepal_width double, petal_length double, petal_width double, category string";
data = CsvSourceBatchOp().setFilePath(URL).setSchemaStr(SCHEMA_STR)
mlpc = MultilayerPerceptronTrainBatchOp() \
.setFeatureCols(["sepal_length", "sepal_width", "petal_length", "petal_width"]) \
.setLabelCol("category") \
.setLayers([4, 5, 3]) \
.setMaxIter(20)
predictor = MultilayerPerceptronPredictBatchOp() \
.setPredictionCol("pred_label") \
.setPredictionDetailCol("pred_detail")
model = mlpc.linkFrom(data)
model.print()
| 38.488372
| 121
| 0.648943
| 159
| 1,655
| 6.591195
| 0.345912
| 0.034351
| 0.022901
| 0.032443
| 0.870229
| 0.870229
| 0.870229
| 0.870229
| 0.870229
| 0.870229
| 0
| 0.008614
| 0.228399
| 1,655
| 42
| 122
| 39.404762
| 0.81206
| 0
| 0
| 0.774194
| 0
| 0.064516
| 0.281571
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.064516
| false
| 0
| 0.064516
| 0
| 0.16129
| 0.064516
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
15a884c56a5cce0cd33a3185a3597c408ebdec65
| 11,736
|
py
|
Python
|
uniqueWord.py
|
Gokender/movie-genre-analyser
|
7f401b18d8790c2785f900bfe49acad2549a63b6
|
[
"MIT"
] | null | null | null |
uniqueWord.py
|
Gokender/movie-genre-analyser
|
7f401b18d8790c2785f900bfe49acad2549a63b6
|
[
"MIT"
] | null | null | null |
uniqueWord.py
|
Gokender/movie-genre-analyser
|
7f401b18d8790c2785f900bfe49acad2549a63b6
|
[
"MIT"
] | null | null | null |
import codecs
def uniqueWord(list_1, list_2):
list_res = []
for it in list_1:
try:
#print(it)
if it not in list_2:
list_res.append(it)
except Exception as e:
continue
return list_res
movie_genres = ['drama','action','comedy','sci-fi','crime','thriller','romance','horror','war','fantasy','western','adventure']
list_drama = []
list_action = []
list_comedy = []
list_scifi = []
list_crime = []
list_thriller = []
list_romance = []
list_horror = []
list_war = []
list_fantasy = []
list_western = []
list_adventure = []
list_result = []
for movie_genre in movie_genres:
file_result = codecs.open('results\\' + movie_genre + '_reduced2.txt',encoding='utf8')
print('Openning : ' + movie_genre)
if(movie_genre == 'drama'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_drama.append(word)
elif(movie_genre == 'action'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_action.append(word)
elif(movie_genre == 'comedy'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_comedy.append(word)
elif(movie_genre == 'sci-fi'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_scifi.append(word)
elif(movie_genre == 'crime'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_crime.append(word)
elif(movie_genre == 'thriller'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_thriller.append(word)
elif(movie_genre == 'romance'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_romance.append(word)
elif(movie_genre == 'horror'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_horror.append(word)
elif(movie_genre == 'war'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_war.append(word)
elif(movie_genre == 'fantasy'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_fantasy.append(word)
elif(movie_genre == 'western'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_western.append(word)
elif(movie_genre == 'adventure'):
lines = file_result.readlines()
for line in lines:
word = line.split(';')[0]
list_adventure.append(word)
file_result.close()
#DRAMA
print('Searching Drama')
list_result = uniqueWord(list_drama,list_action)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_horror)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\drama_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#ACTION
print('Searching Action')
list_result = uniqueWord(list_action,list_drama)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_horror)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\action_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#COMEDY
print('Searching Comedy')
list_result = uniqueWord(list_comedy,list_drama)
list_result = uniqueWord(list_result,list_action)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_horror)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\comedy_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#SCI-FI
print('Searching Sci-fi')
list_result = uniqueWord(list_scifi,list_drama)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_action)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_horror)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\sci-fi_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#CRIME
print('Searching Crime')
list_result = uniqueWord(list_crime,list_drama)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_action)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_horror)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\crime_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#THRILLER
print('Searching Thriller')
list_result = uniqueWord(list_thriller,list_drama)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_action)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_horror)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\thriller_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#ROMANCE
print('Searching Romance')
list_result = uniqueWord(list_romance,list_drama)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_action)
list_result = uniqueWord(list_result,list_horror)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\romance_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#HORROR
print('Searching Horror')
list_result = uniqueWord(list_horror,list_drama)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_action)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\horror_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#WAR
print('Searching War')
list_result = uniqueWord(list_war,list_drama)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_action)
list_result = uniqueWord(list_result,list_horror)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\war_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#FANTASY
print('Searching Fantasy')
list_result = uniqueWord(list_fantasy,list_drama)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_action)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_horror)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\fantasy_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#WESTERN
print('Searching Western')
list_result = uniqueWord(list_western,list_drama)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_action)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_horror)
list_result = uniqueWord(list_result,list_adventure)
result = codecs.open('results\\western_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
#ADVENTURE
print('Searching Adventure')
list_result = uniqueWord(list_adventure,list_drama)
list_result = uniqueWord(list_result,list_comedy)
list_result = uniqueWord(list_result,list_scifi)
list_result = uniqueWord(list_result,list_crime)
list_result = uniqueWord(list_result,list_thriller)
list_result = uniqueWord(list_result,list_romance)
list_result = uniqueWord(list_result,list_action)
list_result = uniqueWord(list_result,list_war)
list_result = uniqueWord(list_result,list_fantasy)
list_result = uniqueWord(list_result,list_western)
list_result = uniqueWord(list_result,list_horror)
result = codecs.open('results\\adventure_final.txt','w',encoding='utf8')
for i in list_result:
result.write(i + '\n')
result.close()
| 29.049505
| 127
| 0.746847
| 1,569
| 11,736
| 5.277884
| 0.039516
| 0.32001
| 0.318802
| 0.382562
| 0.868373
| 0.796884
| 0.796884
| 0.79616
| 0.793865
| 0.793865
| 0
| 0.002973
| 0.140167
| 11,736
| 403
| 128
| 29.121588
| 0.817659
| 0.007157
| 0
| 0.685714
| 0
| 0
| 0.067102
| 0.026033
| 0
| 0
| 0
| 0
| 0
| 1
| 0.003571
| false
| 0
| 0.003571
| 0
| 0.010714
| 0.046429
| 0
| 0
| 0
| null | 1
| 1
| 1
| 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
| 9
|
ecd10b9869045896f487b3579ab5cf7f42a7361d
| 28,879
|
py
|
Python
|
sdk/python/pulumi_azure/core/resource_group_cost_management_export.py
|
henriktao/pulumi-azure
|
f1cbcf100b42b916da36d8fe28be3a159abaf022
|
[
"ECL-2.0",
"Apache-2.0"
] | 109
|
2018-06-18T00:19:44.000Z
|
2022-02-20T05:32:57.000Z
|
sdk/python/pulumi_azure/core/resource_group_cost_management_export.py
|
henriktao/pulumi-azure
|
f1cbcf100b42b916da36d8fe28be3a159abaf022
|
[
"ECL-2.0",
"Apache-2.0"
] | 663
|
2018-06-18T21:08:46.000Z
|
2022-03-31T20:10:11.000Z
|
sdk/python/pulumi_azure/core/resource_group_cost_management_export.py
|
henriktao/pulumi-azure
|
f1cbcf100b42b916da36d8fe28be3a159abaf022
|
[
"ECL-2.0",
"Apache-2.0"
] | 41
|
2018-07-19T22:37:38.000Z
|
2022-03-14T10:56:26.000Z
|
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . import outputs
from ._inputs import *
__all__ = ['ResourceGroupCostManagementExportArgs', 'ResourceGroupCostManagementExport']
@pulumi.input_type
class ResourceGroupCostManagementExportArgs:
def __init__(__self__, *,
export_data_options: pulumi.Input['ResourceGroupCostManagementExportExportDataOptionsArgs'],
export_data_storage_location: pulumi.Input['ResourceGroupCostManagementExportExportDataStorageLocationArgs'],
recurrence_period_end_date: pulumi.Input[str],
recurrence_period_start_date: pulumi.Input[str],
recurrence_type: pulumi.Input[str],
resource_group_id: pulumi.Input[str],
active: Optional[pulumi.Input[bool]] = None,
name: Optional[pulumi.Input[str]] = None):
"""
The set of arguments for constructing a ResourceGroupCostManagementExport resource.
:param pulumi.Input['ResourceGroupCostManagementExportExportDataOptionsArgs'] export_data_options: A `export_data_options` block as defined below.
:param pulumi.Input['ResourceGroupCostManagementExportExportDataStorageLocationArgs'] export_data_storage_location: A `export_data_storage_location` block as defined below.
:param pulumi.Input[str] recurrence_period_end_date: The date the export will stop capturing information.
:param pulumi.Input[str] recurrence_period_start_date: The date the export will start capturing information.
:param pulumi.Input[str] recurrence_type: How often the requested information will be exported. Valid values include `Annually`, `Daily`, `Monthly`, `Weekly`.
:param pulumi.Input[str] resource_group_id: The id of the resource group on which to create an export.
:param pulumi.Input[bool] active: Is the cost management export active? Default is `true`.
:param pulumi.Input[str] name: Specifies the name of the Cost Management Export. Changing this forces a new resource to be created.
"""
pulumi.set(__self__, "export_data_options", export_data_options)
pulumi.set(__self__, "export_data_storage_location", export_data_storage_location)
pulumi.set(__self__, "recurrence_period_end_date", recurrence_period_end_date)
pulumi.set(__self__, "recurrence_period_start_date", recurrence_period_start_date)
pulumi.set(__self__, "recurrence_type", recurrence_type)
pulumi.set(__self__, "resource_group_id", resource_group_id)
if active is not None:
pulumi.set(__self__, "active", active)
if name is not None:
pulumi.set(__self__, "name", name)
@property
@pulumi.getter(name="exportDataOptions")
def export_data_options(self) -> pulumi.Input['ResourceGroupCostManagementExportExportDataOptionsArgs']:
"""
A `export_data_options` block as defined below.
"""
return pulumi.get(self, "export_data_options")
@export_data_options.setter
def export_data_options(self, value: pulumi.Input['ResourceGroupCostManagementExportExportDataOptionsArgs']):
pulumi.set(self, "export_data_options", value)
@property
@pulumi.getter(name="exportDataStorageLocation")
def export_data_storage_location(self) -> pulumi.Input['ResourceGroupCostManagementExportExportDataStorageLocationArgs']:
"""
A `export_data_storage_location` block as defined below.
"""
return pulumi.get(self, "export_data_storage_location")
@export_data_storage_location.setter
def export_data_storage_location(self, value: pulumi.Input['ResourceGroupCostManagementExportExportDataStorageLocationArgs']):
pulumi.set(self, "export_data_storage_location", value)
@property
@pulumi.getter(name="recurrencePeriodEndDate")
def recurrence_period_end_date(self) -> pulumi.Input[str]:
"""
The date the export will stop capturing information.
"""
return pulumi.get(self, "recurrence_period_end_date")
@recurrence_period_end_date.setter
def recurrence_period_end_date(self, value: pulumi.Input[str]):
pulumi.set(self, "recurrence_period_end_date", value)
@property
@pulumi.getter(name="recurrencePeriodStartDate")
def recurrence_period_start_date(self) -> pulumi.Input[str]:
"""
The date the export will start capturing information.
"""
return pulumi.get(self, "recurrence_period_start_date")
@recurrence_period_start_date.setter
def recurrence_period_start_date(self, value: pulumi.Input[str]):
pulumi.set(self, "recurrence_period_start_date", value)
@property
@pulumi.getter(name="recurrenceType")
def recurrence_type(self) -> pulumi.Input[str]:
"""
How often the requested information will be exported. Valid values include `Annually`, `Daily`, `Monthly`, `Weekly`.
"""
return pulumi.get(self, "recurrence_type")
@recurrence_type.setter
def recurrence_type(self, value: pulumi.Input[str]):
pulumi.set(self, "recurrence_type", value)
@property
@pulumi.getter(name="resourceGroupId")
def resource_group_id(self) -> pulumi.Input[str]:
"""
The id of the resource group on which to create an export.
"""
return pulumi.get(self, "resource_group_id")
@resource_group_id.setter
def resource_group_id(self, value: pulumi.Input[str]):
pulumi.set(self, "resource_group_id", value)
@property
@pulumi.getter
def active(self) -> Optional[pulumi.Input[bool]]:
"""
Is the cost management export active? Default is `true`.
"""
return pulumi.get(self, "active")
@active.setter
def active(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "active", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the name of the Cost Management Export. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@pulumi.input_type
class _ResourceGroupCostManagementExportState:
def __init__(__self__, *,
active: Optional[pulumi.Input[bool]] = None,
export_data_options: Optional[pulumi.Input['ResourceGroupCostManagementExportExportDataOptionsArgs']] = None,
export_data_storage_location: Optional[pulumi.Input['ResourceGroupCostManagementExportExportDataStorageLocationArgs']] = None,
name: Optional[pulumi.Input[str]] = None,
recurrence_period_end_date: Optional[pulumi.Input[str]] = None,
recurrence_period_start_date: Optional[pulumi.Input[str]] = None,
recurrence_type: Optional[pulumi.Input[str]] = None,
resource_group_id: Optional[pulumi.Input[str]] = None):
"""
Input properties used for looking up and filtering ResourceGroupCostManagementExport resources.
:param pulumi.Input[bool] active: Is the cost management export active? Default is `true`.
:param pulumi.Input['ResourceGroupCostManagementExportExportDataOptionsArgs'] export_data_options: A `export_data_options` block as defined below.
:param pulumi.Input['ResourceGroupCostManagementExportExportDataStorageLocationArgs'] export_data_storage_location: A `export_data_storage_location` block as defined below.
:param pulumi.Input[str] name: Specifies the name of the Cost Management Export. Changing this forces a new resource to be created.
:param pulumi.Input[str] recurrence_period_end_date: The date the export will stop capturing information.
:param pulumi.Input[str] recurrence_period_start_date: The date the export will start capturing information.
:param pulumi.Input[str] recurrence_type: How often the requested information will be exported. Valid values include `Annually`, `Daily`, `Monthly`, `Weekly`.
:param pulumi.Input[str] resource_group_id: The id of the resource group on which to create an export.
"""
if active is not None:
pulumi.set(__self__, "active", active)
if export_data_options is not None:
pulumi.set(__self__, "export_data_options", export_data_options)
if export_data_storage_location is not None:
pulumi.set(__self__, "export_data_storage_location", export_data_storage_location)
if name is not None:
pulumi.set(__self__, "name", name)
if recurrence_period_end_date is not None:
pulumi.set(__self__, "recurrence_period_end_date", recurrence_period_end_date)
if recurrence_period_start_date is not None:
pulumi.set(__self__, "recurrence_period_start_date", recurrence_period_start_date)
if recurrence_type is not None:
pulumi.set(__self__, "recurrence_type", recurrence_type)
if resource_group_id is not None:
pulumi.set(__self__, "resource_group_id", resource_group_id)
@property
@pulumi.getter
def active(self) -> Optional[pulumi.Input[bool]]:
"""
Is the cost management export active? Default is `true`.
"""
return pulumi.get(self, "active")
@active.setter
def active(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "active", value)
@property
@pulumi.getter(name="exportDataOptions")
def export_data_options(self) -> Optional[pulumi.Input['ResourceGroupCostManagementExportExportDataOptionsArgs']]:
"""
A `export_data_options` block as defined below.
"""
return pulumi.get(self, "export_data_options")
@export_data_options.setter
def export_data_options(self, value: Optional[pulumi.Input['ResourceGroupCostManagementExportExportDataOptionsArgs']]):
pulumi.set(self, "export_data_options", value)
@property
@pulumi.getter(name="exportDataStorageLocation")
def export_data_storage_location(self) -> Optional[pulumi.Input['ResourceGroupCostManagementExportExportDataStorageLocationArgs']]:
"""
A `export_data_storage_location` block as defined below.
"""
return pulumi.get(self, "export_data_storage_location")
@export_data_storage_location.setter
def export_data_storage_location(self, value: Optional[pulumi.Input['ResourceGroupCostManagementExportExportDataStorageLocationArgs']]):
pulumi.set(self, "export_data_storage_location", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the name of the Cost Management Export. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="recurrencePeriodEndDate")
def recurrence_period_end_date(self) -> Optional[pulumi.Input[str]]:
"""
The date the export will stop capturing information.
"""
return pulumi.get(self, "recurrence_period_end_date")
@recurrence_period_end_date.setter
def recurrence_period_end_date(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "recurrence_period_end_date", value)
@property
@pulumi.getter(name="recurrencePeriodStartDate")
def recurrence_period_start_date(self) -> Optional[pulumi.Input[str]]:
"""
The date the export will start capturing information.
"""
return pulumi.get(self, "recurrence_period_start_date")
@recurrence_period_start_date.setter
def recurrence_period_start_date(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "recurrence_period_start_date", value)
@property
@pulumi.getter(name="recurrenceType")
def recurrence_type(self) -> Optional[pulumi.Input[str]]:
"""
How often the requested information will be exported. Valid values include `Annually`, `Daily`, `Monthly`, `Weekly`.
"""
return pulumi.get(self, "recurrence_type")
@recurrence_type.setter
def recurrence_type(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "recurrence_type", value)
@property
@pulumi.getter(name="resourceGroupId")
def resource_group_id(self) -> Optional[pulumi.Input[str]]:
"""
The id of the resource group on which to create an export.
"""
return pulumi.get(self, "resource_group_id")
@resource_group_id.setter
def resource_group_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "resource_group_id", value)
class ResourceGroupCostManagementExport(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
active: Optional[pulumi.Input[bool]] = None,
export_data_options: Optional[pulumi.Input[pulumi.InputType['ResourceGroupCostManagementExportExportDataOptionsArgs']]] = None,
export_data_storage_location: Optional[pulumi.Input[pulumi.InputType['ResourceGroupCostManagementExportExportDataStorageLocationArgs']]] = None,
name: Optional[pulumi.Input[str]] = None,
recurrence_period_end_date: Optional[pulumi.Input[str]] = None,
recurrence_period_start_date: Optional[pulumi.Input[str]] = None,
recurrence_type: Optional[pulumi.Input[str]] = None,
resource_group_id: Optional[pulumi.Input[str]] = None,
__props__=None):
"""
Manages a Cost Management Export for a Resource Group.
## Example Usage
```python
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_account = azure.storage.Account("exampleAccount",
resource_group_name=example_resource_group.name,
location=example_resource_group.location,
account_tier="Standard",
account_replication_type="LRS")
example_container = azure.storage.Container("exampleContainer", storage_account_name=azurerm_storage_account["test"]["name"])
example_resource_group_cost_management_export = azure.core.ResourceGroupCostManagementExport("exampleResourceGroupCostManagementExport",
resource_group_id=example_resource_group.id,
recurrence_type="Monthly",
recurrence_period_start_date="2020-08-18T00:00:00Z",
recurrence_period_end_date="2020-09-18T00:00:00Z",
export_data_storage_location=azure.core.ResourceGroupCostManagementExportExportDataStorageLocationArgs(
container_id=azurerm_storage_container["test"]["resource_manager_id"],
root_folder_path="/root/updated",
),
export_data_options=azure.core.ResourceGroupCostManagementExportExportDataOptionsArgs(
type="Usage",
time_frame="WeekToDate",
))
```
## Import
Cost Management Export for a Resource Group can be imported using the `resource id`, e.g.
```sh
$ pulumi import azure:core/resourceGroupCostManagementExport:ResourceGroupCostManagementExport example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.CostManagement/exports/export1
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[bool] active: Is the cost management export active? Default is `true`.
:param pulumi.Input[pulumi.InputType['ResourceGroupCostManagementExportExportDataOptionsArgs']] export_data_options: A `export_data_options` block as defined below.
:param pulumi.Input[pulumi.InputType['ResourceGroupCostManagementExportExportDataStorageLocationArgs']] export_data_storage_location: A `export_data_storage_location` block as defined below.
:param pulumi.Input[str] name: Specifies the name of the Cost Management Export. Changing this forces a new resource to be created.
:param pulumi.Input[str] recurrence_period_end_date: The date the export will stop capturing information.
:param pulumi.Input[str] recurrence_period_start_date: The date the export will start capturing information.
:param pulumi.Input[str] recurrence_type: How often the requested information will be exported. Valid values include `Annually`, `Daily`, `Monthly`, `Weekly`.
:param pulumi.Input[str] resource_group_id: The id of the resource group on which to create an export.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: ResourceGroupCostManagementExportArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Manages a Cost Management Export for a Resource Group.
## Example Usage
```python
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_account = azure.storage.Account("exampleAccount",
resource_group_name=example_resource_group.name,
location=example_resource_group.location,
account_tier="Standard",
account_replication_type="LRS")
example_container = azure.storage.Container("exampleContainer", storage_account_name=azurerm_storage_account["test"]["name"])
example_resource_group_cost_management_export = azure.core.ResourceGroupCostManagementExport("exampleResourceGroupCostManagementExport",
resource_group_id=example_resource_group.id,
recurrence_type="Monthly",
recurrence_period_start_date="2020-08-18T00:00:00Z",
recurrence_period_end_date="2020-09-18T00:00:00Z",
export_data_storage_location=azure.core.ResourceGroupCostManagementExportExportDataStorageLocationArgs(
container_id=azurerm_storage_container["test"]["resource_manager_id"],
root_folder_path="/root/updated",
),
export_data_options=azure.core.ResourceGroupCostManagementExportExportDataOptionsArgs(
type="Usage",
time_frame="WeekToDate",
))
```
## Import
Cost Management Export for a Resource Group can be imported using the `resource id`, e.g.
```sh
$ pulumi import azure:core/resourceGroupCostManagementExport:ResourceGroupCostManagementExport example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.CostManagement/exports/export1
```
:param str resource_name: The name of the resource.
:param ResourceGroupCostManagementExportArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(ResourceGroupCostManagementExportArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
active: Optional[pulumi.Input[bool]] = None,
export_data_options: Optional[pulumi.Input[pulumi.InputType['ResourceGroupCostManagementExportExportDataOptionsArgs']]] = None,
export_data_storage_location: Optional[pulumi.Input[pulumi.InputType['ResourceGroupCostManagementExportExportDataStorageLocationArgs']]] = None,
name: Optional[pulumi.Input[str]] = None,
recurrence_period_end_date: Optional[pulumi.Input[str]] = None,
recurrence_period_start_date: Optional[pulumi.Input[str]] = None,
recurrence_type: Optional[pulumi.Input[str]] = None,
resource_group_id: Optional[pulumi.Input[str]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = ResourceGroupCostManagementExportArgs.__new__(ResourceGroupCostManagementExportArgs)
__props__.__dict__["active"] = active
if export_data_options is None and not opts.urn:
raise TypeError("Missing required property 'export_data_options'")
__props__.__dict__["export_data_options"] = export_data_options
if export_data_storage_location is None and not opts.urn:
raise TypeError("Missing required property 'export_data_storage_location'")
__props__.__dict__["export_data_storage_location"] = export_data_storage_location
__props__.__dict__["name"] = name
if recurrence_period_end_date is None and not opts.urn:
raise TypeError("Missing required property 'recurrence_period_end_date'")
__props__.__dict__["recurrence_period_end_date"] = recurrence_period_end_date
if recurrence_period_start_date is None and not opts.urn:
raise TypeError("Missing required property 'recurrence_period_start_date'")
__props__.__dict__["recurrence_period_start_date"] = recurrence_period_start_date
if recurrence_type is None and not opts.urn:
raise TypeError("Missing required property 'recurrence_type'")
__props__.__dict__["recurrence_type"] = recurrence_type
if resource_group_id is None and not opts.urn:
raise TypeError("Missing required property 'resource_group_id'")
__props__.__dict__["resource_group_id"] = resource_group_id
super(ResourceGroupCostManagementExport, __self__).__init__(
'azure:core/resourceGroupCostManagementExport:ResourceGroupCostManagementExport',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
active: Optional[pulumi.Input[bool]] = None,
export_data_options: Optional[pulumi.Input[pulumi.InputType['ResourceGroupCostManagementExportExportDataOptionsArgs']]] = None,
export_data_storage_location: Optional[pulumi.Input[pulumi.InputType['ResourceGroupCostManagementExportExportDataStorageLocationArgs']]] = None,
name: Optional[pulumi.Input[str]] = None,
recurrence_period_end_date: Optional[pulumi.Input[str]] = None,
recurrence_period_start_date: Optional[pulumi.Input[str]] = None,
recurrence_type: Optional[pulumi.Input[str]] = None,
resource_group_id: Optional[pulumi.Input[str]] = None) -> 'ResourceGroupCostManagementExport':
"""
Get an existing ResourceGroupCostManagementExport resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[bool] active: Is the cost management export active? Default is `true`.
:param pulumi.Input[pulumi.InputType['ResourceGroupCostManagementExportExportDataOptionsArgs']] export_data_options: A `export_data_options` block as defined below.
:param pulumi.Input[pulumi.InputType['ResourceGroupCostManagementExportExportDataStorageLocationArgs']] export_data_storage_location: A `export_data_storage_location` block as defined below.
:param pulumi.Input[str] name: Specifies the name of the Cost Management Export. Changing this forces a new resource to be created.
:param pulumi.Input[str] recurrence_period_end_date: The date the export will stop capturing information.
:param pulumi.Input[str] recurrence_period_start_date: The date the export will start capturing information.
:param pulumi.Input[str] recurrence_type: How often the requested information will be exported. Valid values include `Annually`, `Daily`, `Monthly`, `Weekly`.
:param pulumi.Input[str] resource_group_id: The id of the resource group on which to create an export.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _ResourceGroupCostManagementExportState.__new__(_ResourceGroupCostManagementExportState)
__props__.__dict__["active"] = active
__props__.__dict__["export_data_options"] = export_data_options
__props__.__dict__["export_data_storage_location"] = export_data_storage_location
__props__.__dict__["name"] = name
__props__.__dict__["recurrence_period_end_date"] = recurrence_period_end_date
__props__.__dict__["recurrence_period_start_date"] = recurrence_period_start_date
__props__.__dict__["recurrence_type"] = recurrence_type
__props__.__dict__["resource_group_id"] = resource_group_id
return ResourceGroupCostManagementExport(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def active(self) -> pulumi.Output[Optional[bool]]:
"""
Is the cost management export active? Default is `true`.
"""
return pulumi.get(self, "active")
@property
@pulumi.getter(name="exportDataOptions")
def export_data_options(self) -> pulumi.Output['outputs.ResourceGroupCostManagementExportExportDataOptions']:
"""
A `export_data_options` block as defined below.
"""
return pulumi.get(self, "export_data_options")
@property
@pulumi.getter(name="exportDataStorageLocation")
def export_data_storage_location(self) -> pulumi.Output['outputs.ResourceGroupCostManagementExportExportDataStorageLocation']:
"""
A `export_data_storage_location` block as defined below.
"""
return pulumi.get(self, "export_data_storage_location")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
Specifies the name of the Cost Management Export. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "name")
@property
@pulumi.getter(name="recurrencePeriodEndDate")
def recurrence_period_end_date(self) -> pulumi.Output[str]:
"""
The date the export will stop capturing information.
"""
return pulumi.get(self, "recurrence_period_end_date")
@property
@pulumi.getter(name="recurrencePeriodStartDate")
def recurrence_period_start_date(self) -> pulumi.Output[str]:
"""
The date the export will start capturing information.
"""
return pulumi.get(self, "recurrence_period_start_date")
@property
@pulumi.getter(name="recurrenceType")
def recurrence_type(self) -> pulumi.Output[str]:
"""
How often the requested information will be exported. Valid values include `Annually`, `Daily`, `Monthly`, `Weekly`.
"""
return pulumi.get(self, "recurrence_type")
@property
@pulumi.getter(name="resourceGroupId")
def resource_group_id(self) -> pulumi.Output[str]:
"""
The id of the resource group on which to create an export.
"""
return pulumi.get(self, "resource_group_id")
| 51.847397
| 239
| 0.700509
| 3,107
| 28,879
| 6.216608
| 0.074026
| 0.061507
| 0.048563
| 0.053068
| 0.875641
| 0.860678
| 0.851411
| 0.836293
| 0.823557
| 0.804504
| 0
| 0.00548
| 0.210187
| 28,879
| 556
| 240
| 51.940647
| 0.841335
| 0.350878
| 0
| 0.656566
| 1
| 0
| 0.199861
| 0.139862
| 0
| 0
| 0
| 0
| 0
| 1
| 0.158249
| false
| 0.003367
| 0.023569
| 0
| 0.276094
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
bf0c283fe3e98b1923fe91da088f24e4e8e980e7
| 433
|
py
|
Python
|
Codewars/8kyu/logical-calculator/Python/test.py
|
RevansChen/online-judge
|
ad1b07fee7bd3c49418becccda904e17505f3018
|
[
"MIT"
] | 7
|
2017-09-20T16:40:39.000Z
|
2021-08-31T18:15:08.000Z
|
Codewars/8kyu/logical-calculator/Python/test.py
|
RevansChen/online-judge
|
ad1b07fee7bd3c49418becccda904e17505f3018
|
[
"MIT"
] | null | null | null |
Codewars/8kyu/logical-calculator/Python/test.py
|
RevansChen/online-judge
|
ad1b07fee7bd3c49418becccda904e17505f3018
|
[
"MIT"
] | null | null | null |
# Python - 2.7.6
Test.describe('Basic tests')
Test.assert_equals(logical_calc([True, False], 'AND'), False)
Test.assert_equals(logical_calc([True, False], 'OR'), True)
Test.assert_equals(logical_calc([True, False], 'XOR'), True)
Test.assert_equals(logical_calc([True, True, False], 'AND'), False)
Test.assert_equals(logical_calc([True, True, False], 'OR'), True)
Test.assert_equals(logical_calc([True, True, False], 'XOR'), False)
| 39.363636
| 67
| 0.725173
| 65
| 433
| 4.646154
| 0.261538
| 0.198676
| 0.317881
| 0.456954
| 0.860927
| 0.860927
| 0.860927
| 0.754967
| 0.754967
| 0.609272
| 0
| 0.007538
| 0.080831
| 433
| 10
| 68
| 43.3
| 0.751256
| 0.032333
| 0
| 0
| 0
| 0
| 0.064748
| 0
| 0
| 0
| 0
| 0
| 0.857143
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
1796a7ff3c77ed1c764d63ec643fad5d8a60746a
| 8,199
|
py
|
Python
|
iclientpy/test/rest/cmd/wxreceiver/test_WXHookReceiver.py
|
SuperMap/iClientPython
|
5e741c1efda9b12d321909428bd5c95e22482ea7
|
[
"Apache-2.0"
] | 28
|
2018-04-19T07:11:34.000Z
|
2022-02-24T08:31:08.000Z
|
iclientpy/test/rest/cmd/wxreceiver/test_WXHookReceiver.py
|
SuperMap/iClientPython
|
5e741c1efda9b12d321909428bd5c95e22482ea7
|
[
"Apache-2.0"
] | 3
|
2019-05-06T07:58:45.000Z
|
2020-11-18T21:16:38.000Z
|
iclientpy/test/rest/cmd/wxreceiver/test_WXHookReceiver.py
|
SuperMap/iClientPython
|
5e741c1efda9b12d321909428bd5c95e22482ea7
|
[
"Apache-2.0"
] | 8
|
2018-06-14T02:29:53.000Z
|
2020-11-03T01:36:35.000Z
|
from unittest import TestCase
from unittest.mock import MagicMock
from iclientpy.rest.cmd.wxreceiver.server import WXHookReceiver
class WXHookReceiverTest(TestCase):
def setUp(self):
self._msg_fun = MagicMock()
self._crypt = MagicMock()
class Receiver(WXHookReceiver):
def __init__(self):
pass
def get_wxcrypt(self_handler):
return self._crypt
def get_sCorpID(self):
return 'corpid'
def get_msg_fun(self_handler):
return self._msg_fun
self._receiver = Receiver()
self._receiver.send_header = MagicMock()
self._receiver.send_response = MagicMock()
self._receiver.wfile = MagicMock()
self._receiver.wfile.write = MagicMock()
self._receiver.rfile = MagicMock()
self._receiver.rfile.read = MagicMock()
self._receiver.end_headers = MagicMock()
def test_get_success(self):
self._receiver.path = '/index?msg_signature=4662d1b7a6decfefad3c8e2e0c330e6fb2ec1e6e×tamp=1530755808&nonce=1530409251&echostr=abc'
self._crypt.VerifyURL = MagicMock(return_value=(0,'abc'.encode('utf8')))
self._receiver.do_GET()
write = self._receiver.wfile.write #type:MagicMock
write.assert_called_with('abc'.encode('utf8'))
def test_get_failed(self):
self._receiver.path = '/index?msg_signature=4662d1b7a6decfefad3c8e2e0c330e6fb2ec1e6e×tamp=1530755808&nonce=1530409251&echostr=abc'
self._crypt.VerifyURL = MagicMock(return_value=(-1,None))
self._receiver.finish = MagicMock()
self._receiver.do_GET()
self._receiver.finish.assert_called()
def test_get_failed(self):
self._receiver.path = '/index?msg_signature=4662d1b7a6decfefad3c8e2e0c330e6fb2ec1e6e×tamp=1530755808&nonce=1530409251&echostr=abc'
self._crypt.VerifyURL = MagicMock(return_value=(1,None))
self._receiver.do_GET()
write = self._receiver.wfile.write #type:MagicMock
write.assert_not_called()
def test_post_success(self):
request_body = '<xml><ToUserName><![CDATA[ww211005fad1eca8ba]]></ToUserName><Encrypt><![CDATA[zdNXPCW2tJHGt2NnEk4hD3mIuWXW+1bgR/QnHg2wFtTo2LP+2ALwKyQX+bKQ2a9yoOcDbX/p6s7PT/8RlFngiLhX3biXcEQY1pbSQspmkpCY/0ZjqNpwVoGTlIz7+oEtGf7SMoWAom2b2z3LUW6T8L6OmN24v5HFHETpHYZhVnYUZa1AkGCvI7GwI1wuO0WVNSAB5UNmNdwI42aO/asr1dLNxMDojI3qE7RSRHtbUjPinvRRcykjdJ8AtAryDIPjutOnPTk9zxqmnbxJhfHmsf3SwYu9QBD6IOagKFLF228HClTdiZpWw07kLHnt+an8rOTMTeEPcV40YOMNtq8K11UAYartL635se1Ox1swq/S+hVjNklcbC8aSyCgp9leeX28b+tuN5pAi4HGxjV4kOxIBO7AOgS517+KwrrvY+Fo=]]></Encrypt><AgentID><![CDATA[1000002]]></AgentID></xml>'
self._receiver.headers = {'Content-Length': len(request_body)}
read = self._receiver.rfile.read #type: MagicMock
read.return_value = request_body.encode('utf8')
self._receiver.path = '/index?msg_signature=4662d1b7a6decfefad3c8e2e0c330e6fb2ec1e6e×tamp=1530755808&nonce=1530409251&echostr=abc'
self._crypt.DecryptMsg = MagicMock(return_value=(0,'<xml><ToUserName><![CDATA[ww211005fad1eca8ba]]></ToUserName><FromUserName><![CDATA[GuYongQuan]]></FromUserName><CreateTime>1530771910</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[list]]></Content><MsgId>1958266229</MsgId><AgentID>1000002</AgentID></xml>'.encode('utf8')))
self._crypt.EncryptMsg = MagicMock(return_value=(0, 'EncryptMsg_send_result'))
self._msg_fun.return_value = 'send_result'
self._receiver.do_POST()
write = self._receiver.wfile.write #type:MagicMock
write.assert_called_with('EncryptMsg_send_result'.encode('utf8'))
reply_msg = self._crypt.EncryptMsg.call_args[0][0]
self.assertIn('GuYongQuan', reply_msg)
def test_post_exception(self):
request_body = '<xml><ToUserName><![CDATA[ww211005fad1eca8ba]]></ToUserName><Encrypt><![CDATA[zdNXPCW2tJHGt2NnEk4hD3mIuWXW+1bgR/QnHg2wFtTo2LP+2ALwKyQX+bKQ2a9yoOcDbX/p6s7PT/8RlFngiLhX3biXcEQY1pbSQspmkpCY/0ZjqNpwVoGTlIz7+oEtGf7SMoWAom2b2z3LUW6T8L6OmN24v5HFHETpHYZhVnYUZa1AkGCvI7GwI1wuO0WVNSAB5UNmNdwI42aO/asr1dLNxMDojI3qE7RSRHtbUjPinvRRcykjdJ8AtAryDIPjutOnPTk9zxqmnbxJhfHmsf3SwYu9QBD6IOagKFLF228HClTdiZpWw07kLHnt+an8rOTMTeEPcV40YOMNtq8K11UAYartL635se1Ox1swq/S+hVjNklcbC8aSyCgp9leeX28b+tuN5pAi4HGxjV4kOxIBO7AOgS517+KwrrvY+Fo=]]></Encrypt><AgentID><![CDATA[1000002]]></AgentID></xml>'
self._receiver.headers = {'Content-Length': len(request_body)}
read = self._receiver.rfile.read #type: MagicMock
read.return_value = request_body.encode('utf8')
self._receiver.path = '/index?msg_signature=4662d1b7a6decfefad3c8e2e0c330e6fb2ec1e6e×tamp=1530755808&nonce=1530409251&echostr=abc'
self._crypt.DecryptMsg = MagicMock(return_value=(0,'<xml><ToUserName><![CDATA[ww211005fad1eca8ba]]></ToUserName><FromUserName><![CDATA[GuYongQuan]]></FromUserName><CreateTime>1530771910</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[list]]></Content><MsgId>1958266229</MsgId><AgentID>1000002</AgentID></xml>'.encode('utf8')))
self._crypt.EncryptMsg = MagicMock(return_value=(0, 'EncryptMsg_send_result'))
self._msg_fun.side_effect = KeyError('foo')
self._receiver.do_POST()
write = self._receiver.wfile.write #type:MagicMock
reply_msg = self._crypt.EncryptMsg.call_args[0][0]
self.assertIn('Error', reply_msg)
def test_post_DecryptMsg_failed(self):
request_body = '<xml><ToUserName><![CDATA[ww211005fad1eca8ba]]></ToUserName><Encrypt><![CDATA[zdNXPCW2tJHGt2NnEk4hD3mIuWXW+1bgR/QnHg2wFtTo2LP+2ALwKyQX+bKQ2a9yoOcDbX/p6s7PT/8RlFngiLhX3biXcEQY1pbSQspmkpCY/0ZjqNpwVoGTlIz7+oEtGf7SMoWAom2b2z3LUW6T8L6OmN24v5HFHETpHYZhVnYUZa1AkGCvI7GwI1wuO0WVNSAB5UNmNdwI42aO/asr1dLNxMDojI3qE7RSRHtbUjPinvRRcykjdJ8AtAryDIPjutOnPTk9zxqmnbxJhfHmsf3SwYu9QBD6IOagKFLF228HClTdiZpWw07kLHnt+an8rOTMTeEPcV40YOMNtq8K11UAYartL635se1Ox1swq/S+hVjNklcbC8aSyCgp9leeX28b+tuN5pAi4HGxjV4kOxIBO7AOgS517+KwrrvY+Fo=]]></Encrypt><AgentID><![CDATA[1000002]]></AgentID></xml>'
self._receiver.headers = {'Content-Length': len(request_body)}
read = self._receiver.rfile.read #type: MagicMock
read.return_value = request_body.encode('utf8')
self._receiver.path = '/index?msg_signature=4662d1b7a6decfefad3c8e2e0c330e6fb2ec1e6e×tamp=1530755808&nonce=1530409251&echostr=abc'
self._crypt.DecryptMsg = MagicMock(return_value=(1, None))
self._receiver.finish = MagicMock()
self._receiver.do_POST()
self._receiver.finish.assert_called()
def test_post_EncryptMsg_failed(self):
request_body = '<xml><ToUserName><![CDATA[ww211005fad1eca8ba]]></ToUserName><Encrypt><![CDATA[zdNXPCW2tJHGt2NnEk4hD3mIuWXW+1bgR/QnHg2wFtTo2LP+2ALwKyQX+bKQ2a9yoOcDbX/p6s7PT/8RlFngiLhX3biXcEQY1pbSQspmkpCY/0ZjqNpwVoGTlIz7+oEtGf7SMoWAom2b2z3LUW6T8L6OmN24v5HFHETpHYZhVnYUZa1AkGCvI7GwI1wuO0WVNSAB5UNmNdwI42aO/asr1dLNxMDojI3qE7RSRHtbUjPinvRRcykjdJ8AtAryDIPjutOnPTk9zxqmnbxJhfHmsf3SwYu9QBD6IOagKFLF228HClTdiZpWw07kLHnt+an8rOTMTeEPcV40YOMNtq8K11UAYartL635se1Ox1swq/S+hVjNklcbC8aSyCgp9leeX28b+tuN5pAi4HGxjV4kOxIBO7AOgS517+KwrrvY+Fo=]]></Encrypt><AgentID><![CDATA[1000002]]></AgentID></xml>'
self._receiver.headers = {'Content-Length': len(request_body)}
read = self._receiver.rfile.read #type: MagicMock
read.return_value = request_body.encode('utf8')
self._receiver.path = '/index?msg_signature=4662d1b7a6decfefad3c8e2e0c330e6fb2ec1e6e×tamp=1530755808&nonce=1530409251&echostr=abc'
self._crypt.DecryptMsg = MagicMock(return_value=(0, '<xml><ToUserName><![CDATA[ww211005fad1eca8ba]]></ToUserName><FromUserName><![CDATA[GuYongQuan]]></FromUserName><CreateTime>1530771910</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[list]]></Content><MsgId>1958266229</MsgId><AgentID>1000002</AgentID></xml>'.encode()))
self._crypt.EncryptMsg = MagicMock(return_value=(1, None))
self._receiver.finish = MagicMock()
self._receiver.do_POST()
self._receiver.finish.assert_called()
| 75.220183
| 589
| 0.746189
| 751
| 8,199
| 7.94008
| 0.154461
| 0.080496
| 0.03354
| 0.024652
| 0.871877
| 0.865504
| 0.862318
| 0.856113
| 0.856113
| 0.856113
| 0
| 0.102499
| 0.131357
| 8,199
| 108
| 590
| 75.916667
| 0.734766
| 0.014148
| 0
| 0.533333
| 0
| 0.077778
| 0.508162
| 0.491462
| 0
| 0
| 0
| 0
| 0.088889
| 1
| 0.133333
| false
| 0.011111
| 0.033333
| 0.033333
| 0.222222
| 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
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
bd5d154f1dd2b5140de7f73dc030d0dc3e275134
| 18,574
|
py
|
Python
|
tests/app/v2_company_companyinfolist_test.py
|
BoostryJP/ibet-Wallet-API
|
da7323a298bdb746e93da8a9b57a5da1dd6f14ac
|
[
"Apache-2.0"
] | 6
|
2021-06-16T02:06:21.000Z
|
2021-09-20T09:50:56.000Z
|
tests/app/v2_company_companyinfolist_test.py
|
BoostryJP/ibet-Wallet-API
|
da7323a298bdb746e93da8a9b57a5da1dd6f14ac
|
[
"Apache-2.0"
] | 68
|
2021-04-06T03:44:54.000Z
|
2022-03-29T02:00:02.000Z
|
tests/app/v2_company_companyinfolist_test.py
|
BoostryJP/ibet-Wallet-API
|
da7323a298bdb746e93da8a9b57a5da1dd6f14ac
|
[
"Apache-2.0"
] | null | null | null |
"""
Copyright BOOSTRY Co., Ltd.
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.
SPDX-License-Identifier: Apache-2.0
"""
from unittest import mock
from eth_utils import to_checksum_address
from web3 import Web3
from web3.middleware import geth_poa_middleware
from app.model.db import (
Listing,
Company
)
from app import config
from app.contracts import Contract
from tests.account_config import eth_account
from tests.contract_modules import (
issue_coupon_token,
coupon_register_list
)
web3 = Web3(Web3.HTTPProvider(config.WEB3_HTTP_PROVIDER))
web3.middleware_onion.inject(geth_poa_middleware, layer=0)
class TestCompanyCompanyInfoList:
# テスト対象API
apiurl = '/v2/Companies'
@staticmethod
def token_attribute(exchange_address):
attribute = {
'name': 'テストクーポン',
'symbol': 'COUPON',
'totalSupply': 10000,
'tradableExchange': exchange_address,
'details': 'クーポン詳細',
'returnDetails': 'リターン詳細',
'memo': 'クーポンメモ欄',
'expirationDate': '20191231',
'transferable': True,
'contactInformation': '問い合わせ先',
'privacyPolicy': 'プライバシーポリシー'
}
return attribute
@staticmethod
def tokenlist_contract():
deployer = eth_account['deployer']
web3.eth.defaultAccount = deployer['account_address']
contract_address, abi = Contract. \
deploy_contract('TokenList', [], deployer['account_address'])
return {'address': contract_address, 'abi': abi}
@staticmethod
def list_token(session, token):
listed_token = Listing()
listed_token.token_address = token['address']
listed_token.is_public = True
listed_token.max_holding_quantity = 1
listed_token.max_sell_amount = 1000
session.add(listed_token)
# 正常系1-1: 登録済みのトークンアドレスに紐づく会社情報が返却される(ローカルJSON)
def test_normal_1_1(self, client, session, shared_contract, mocked_company_list):
# テスト用アカウント
issuerList = [eth_account['issuer'], eth_account['deployer']]
# TokenListコントラクトアドレスの設定
token_list = TestCompanyCompanyInfoList.tokenlist_contract()
config.TOKEN_LIST_CONTRACT_ADDRESS = token_list['address']
# データ準備:新規発行(クーポン)
exchange_address = \
to_checksum_address(
shared_contract['IbetCouponExchange']['address'])
for i in range(0, 2):
attribute = TestCompanyCompanyInfoList. \
token_attribute(exchange_address)
token = issue_coupon_token(issuerList[i], attribute)
coupon_register_list(issuerList[i], token, token_list)
# 取扱トークンデータ挿入
TestCompanyCompanyInfoList.list_token(session, token)
resp = client.simulate_get(self.apiurl)
assumed_body = [
{
"address": eth_account['issuer']['account_address'],
"corporate_name": "株式会社DEMO",
"rsa_publickey": "-----BEGIN PUBLIC KEY-----\nMIIFIjANBgkqhkiG9w0BAQEFAAOCBQ8AMIIFCgKCBQEAtiBUQ2vdYvIqnCdUzKIC\np7jIYVtJy8KGniy6ktE0DTcYG70pFYkGDyI043meSB6Lkk0rNWaKBn3wyz4lx2oX\n3JySFyXR4vE4DNTEKS0htImO4RuK4M50v7LOfB8VphXzu9JkdVuN8LuMx6L6dhsd\nTN/aUvXULvjOy9AJekl24s44w4BgEfGj/uBYNAmiNmpM3lnIdJOg1T+4aEShHyVN\n98dv1DZ1Hh0YhMmqHqRGIzAQ6pKoly2xSVEmwBV4l2O3XEZ8ErVNgHdi6BRQrIBl\n+zQn5TysSGv5TIO1ahztUIygrzX7aEa+QnF1ROBBJ8yBW0VjjKI2Oh3wDT8ROaWb\ntB7gYQlMX9St/HJvGKaDKPDGurMFsEZeeD9Y4GWlFFkQplKIC3Kr4u6TIxcAZyG3\ntIz1IZomm/Lh9eiFiAbOMLYPdPCzh1A6uCRoJuqrNXYbE2egpLsKSkEe4VAcdaPo\nVuOXLpbDaew0cvXQR5IklHGGPPGVqQV1cmJWIqF5b1bzqziu2No+TLZceUd3N9Eh\nQIYVG4rbX2I/x2/WFeG5RHl9Zc/iSUomUqpnGY3ved61smb7uklF/7ueyj8TIm7O\ncJxhYjj+szXxV2RJyxLvSPzloQ4GDI9wd0zlya2CoYgAONJ7wm82b1LrLLhfpns2\ndSsN8htFX83p0dNn6f8ssKgA3rFbFFnBTQyFxlHO/An4qZflXtk1GsEc56g3mJFp\nrFANLpyum5mkHo9TbkL3K4mRGM1DGcLXWJwFUjDxS/OvjzDXw2dNiyrPeClvTpAb\npFfw/zqVd7ZrnTFg26bpUmM8flc6IRji49veOOMM7jMJN7mmu/pLd/Pg22oez23G\n6QsPDvqqXgjyg1NGo7natX6gyAYMpWZWOHj+Y2lffzcJYUo+wPFt/xNkAuCcDZem\nAiicfsGfniE67G1nfmwkykVwk9rTFCO8SnFei8wMpEAMYETYOS4ldavLfhY6mrF1\nItA5mlkMI84v3ROqPSp3s6F9oGYzPi5zMcgc67wIFGgaPb6i8+puui6BUbj83qOU\nKuKoQAGe9+NRnAkWSpbX07cX6XkPieTkBHEYfGaQTQOnsSs++PIk3kH5Arfjk0R5\nu1ZluzVdOXUn8D5WPfh9UFzqyXzo1HOIHxDkPejpPlNzO1w6qVQC+UiR/R2iug/U\n7StoLz476tQOwbfmnzUA6AbOKjRgN5laRoBac4BbGPJisGysOBruL7lgrw0XVtnh\nknChXfSYezxz/EtiGmO40HKAGudHDkz4gmPDkF4wlIyfDbQZOnNohz4zuOjr9Yi/\nJQVpqKxug2LXyJp38UaxL1LIT6ZyJSsaSrKAB21tsYAbksyPCVS6L6jkz8lsnlYg\nLj7lj6HQcbN8WO72+Z8Ddj/cPXJwEq4OTbtkPiPdcvSZjcBR9f3TmrQjDG0ROspt\nI/m4KhWfm7ed+eZKA1IqygFRyi6i0w6p+VbeBNgXqAiQI5GkDHqAiqv4OVyZoQB8\neunu5qM49r6bw6DJCqlg6lZDCptdKWtNBo9zgEegrJ/3oVI7x0kE7KQ4gPo5uY7j\nvBqGwjw0fIGPjrP/JKIQqGvm/ETwlfPwVbmCsvEHbqEY+6f84TnmolgjPMnbar6Q\nSDuvqVApY7yNCEue5X0pLRAd+287VBVVvsOsZVOSj02w4PGIlsg2Y33BbcpwESzr\n4McG/dPyTRFv9mYtFPpyV50CAwEAAQ==\n-----END PUBLIC KEY-----",
"homepage": "https://www.aaaa.com/jp/"
},
{
"address": eth_account['deployer']['account_address'],
"corporate_name": "株式会社DEMO",
"rsa_publickey": "-----BEGIN PUBLIC KEY-----\nMIIFIjANBgkqhkiG9w0BAQEFAAOCBQ8AMIIFCgKCBQEAtiBUQ2vdYvIqnCdUzKIC\np7jIYVtJy8KGniy6ktE0DTcYG70pFYkGDyI043meSB6Lkk0rNWaKBn3wyz4lx2oX\n3JySFyXR4vE4DNTEKS0htImO4RuK4M50v7LOfB8VphXzu9JkdVuN8LuMx6L6dhsd\nTN/aUvXULvjOy9AJekl24s44w4BgEfGj/uBYNAmiNmpM3lnIdJOg1T+4aEShHyVN\n98dv1DZ1Hh0YhMmqHqRGIzAQ6pKoly2xSVEmwBV4l2O3XEZ8ErVNgHdi6BRQrIBl\n+zQn5TysSGv5TIO1ahztUIygrzX7aEa+QnF1ROBBJ8yBW0VjjKI2Oh3wDT8ROaWb\ntB7gYQlMX9St/HJvGKaDKPDGurMFsEZeeD9Y4GWlFFkQplKIC3Kr4u6TIxcAZyG3\ntIz1IZomm/Lh9eiFiAbOMLYPdPCzh1A6uCRoJuqrNXYbE2egpLsKSkEe4VAcdaPo\nVuOXLpbDaew0cvXQR5IklHGGPPGVqQV1cmJWIqF5b1bzqziu2No+TLZceUd3N9Eh\nQIYVG4rbX2I/x2/WFeG5RHl9Zc/iSUomUqpnGY3ved61smb7uklF/7ueyj8TIm7O\ncJxhYjj+szXxV2RJyxLvSPzloQ4GDI9wd0zlya2CoYgAONJ7wm82b1LrLLhfpns2\ndSsN8htFX83p0dNn6f8ssKgA3rFbFFnBTQyFxlHO/An4qZflXtk1GsEc56g3mJFp\nrFANLpyum5mkHo9TbkL3K4mRGM1DGcLXWJwFUjDxS/OvjzDXw2dNiyrPeClvTpAb\npFfw/zqVd7ZrnTFg26bpUmM8flc6IRji49veOOMM7jMJN7mmu/pLd/Pg22oez23G\n6QsPDvqqXgjyg1NGo7natX6gyAYMpWZWOHj+Y2lffzcJYUo+wPFt/xNkAuCcDZem\nAiicfsGfniE67G1nfmwkykVwk9rTFCO8SnFei8wMpEAMYETYOS4ldavLfhY6mrF1\nItA5mlkMI84v3ROqPSp3s6F9oGYzPi5zMcgc67wIFGgaPb6i8+puui6BUbj83qOU\nKuKoQAGe9+NRnAkWSpbX07cX6XkPieTkBHEYfGaQTQOnsSs++PIk3kH5Arfjk0R5\nu1ZluzVdOXUn8D5WPfh9UFzqyXzo1HOIHxDkPejpPlNzO1w6qVQC+UiR/R2iug/U\n7StoLz476tQOwbfmnzUA6AbOKjRgN5laRoBac4BbGPJisGysOBruL7lgrw0XVtnh\nknChXfSYezxz/EtiGmO40HKAGudHDkz4gmPDkF4wlIyfDbQZOnNohz4zuOjr9Yi/\nJQVpqKxug2LXyJp38UaxL1LIT6ZyJSsaSrKAB21tsYAbksyPCVS6L6jkz8lsnlYg\nLj7lj6HQcbN8WO72+Z8Ddj/cPXJwEq4OTbtkPiPdcvSZjcBR9f3TmrQjDG0ROspt\nI/m4KhWfm7ed+eZKA1IqygFRyi6i0w6p+VbeBNgXqAiQI5GkDHqAiqv4OVyZoQB8\neunu5qM49r6bw6DJCqlg6lZDCptdKWtNBo9zgEegrJ/3oVI7x0kE7KQ4gPo5uY7j\nvBqGwjw0fIGPjrP/JKIQqGvm/ETwlfPwVbmCsvEHbqEY+6f84TnmolgjPMnbar6Q\nSDuvqVApY7yNCEue5X0pLRAd+287VBVVvsOsZVOSj02w4PGIlsg2Y33BbcpwESzr\n4McG/dPyTRFv9mYtFPpyV50CAwEAAQ==\n-----END PUBLIC KEY-----",
"homepage": "https://www.aaaa.com/jp/"
}
]
assert resp.status_code == 200
assert resp.json['meta'] == {'code': 200, 'message': 'OK'}
assert resp.json['data'] == assumed_body
# 正常系1-2: 登録済みのトークンアドレスに紐づく会社情報が返却される(DB)
@mock.patch("app.config.APP_ENV", "dev")
@mock.patch("app.config.COMPANY_LIST_LOCAL_MODE", False)
def test_normal_1_2(self, client, session, shared_contract):
_company = Company()
_company.address = eth_account['issuer']['account_address']
_company.corporate_name = "株式会社DEMO"
_company.rsa_publickey = "-----BEGIN PUBLIC KEY-----\nMIIFIjANBgkqhkiG9w0BAQEFAAOCBQ8AMIIFCgKCBQEAtiBUQ2vdYvIqnCdUzKIC\np7jIYVtJy8KGniy6ktE0DTcYG70pFYkGDyI043meSB6Lkk0rNWaKBn3wyz4lx2oX\n3JySFyXR4vE4DNTEKS0htImO4RuK4M50v7LOfB8VphXzu9JkdVuN8LuMx6L6dhsd\nTN/aUvXULvjOy9AJekl24s44w4BgEfGj/uBYNAmiNmpM3lnIdJOg1T+4aEShHyVN\n98dv1DZ1Hh0YhMmqHqRGIzAQ6pKoly2xSVEmwBV4l2O3XEZ8ErVNgHdi6BRQrIBl\n+zQn5TysSGv5TIO1ahztUIygrzX7aEa+QnF1ROBBJ8yBW0VjjKI2Oh3wDT8ROaWb\ntB7gYQlMX9St/HJvGKaDKPDGurMFsEZeeD9Y4GWlFFkQplKIC3Kr4u6TIxcAZyG3\ntIz1IZomm/Lh9eiFiAbOMLYPdPCzh1A6uCRoJuqrNXYbE2egpLsKSkEe4VAcdaPo\nVuOXLpbDaew0cvXQR5IklHGGPPGVqQV1cmJWIqF5b1bzqziu2No+TLZceUd3N9Eh\nQIYVG4rbX2I/x2/WFeG5RHl9Zc/iSUomUqpnGY3ved61smb7uklF/7ueyj8TIm7O\ncJxhYjj+szXxV2RJyxLvSPzloQ4GDI9wd0zlya2CoYgAONJ7wm82b1LrLLhfpns2\ndSsN8htFX83p0dNn6f8ssKgA3rFbFFnBTQyFxlHO/An4qZflXtk1GsEc56g3mJFp\nrFANLpyum5mkHo9TbkL3K4mRGM1DGcLXWJwFUjDxS/OvjzDXw2dNiyrPeClvTpAb\npFfw/zqVd7ZrnTFg26bpUmM8flc6IRji49veOOMM7jMJN7mmu/pLd/Pg22oez23G\n6QsPDvqqXgjyg1NGo7natX6gyAYMpWZWOHj+Y2lffzcJYUo+wPFt/xNkAuCcDZem\nAiicfsGfniE67G1nfmwkykVwk9rTFCO8SnFei8wMpEAMYETYOS4ldavLfhY6mrF1\nItA5mlkMI84v3ROqPSp3s6F9oGYzPi5zMcgc67wIFGgaPb6i8+puui6BUbj83qOU\nKuKoQAGe9+NRnAkWSpbX07cX6XkPieTkBHEYfGaQTQOnsSs++PIk3kH5Arfjk0R5\nu1ZluzVdOXUn8D5WPfh9UFzqyXzo1HOIHxDkPejpPlNzO1w6qVQC+UiR/R2iug/U\n7StoLz476tQOwbfmnzUA6AbOKjRgN5laRoBac4BbGPJisGysOBruL7lgrw0XVtnh\nknChXfSYezxz/EtiGmO40HKAGudHDkz4gmPDkF4wlIyfDbQZOnNohz4zuOjr9Yi/\nJQVpqKxug2LXyJp38UaxL1LIT6ZyJSsaSrKAB21tsYAbksyPCVS6L6jkz8lsnlYg\nLj7lj6HQcbN8WO72+Z8Ddj/cPXJwEq4OTbtkPiPdcvSZjcBR9f3TmrQjDG0ROspt\nI/m4KhWfm7ed+eZKA1IqygFRyi6i0w6p+VbeBNgXqAiQI5GkDHqAiqv4OVyZoQB8\neunu5qM49r6bw6DJCqlg6lZDCptdKWtNBo9zgEegrJ/3oVI7x0kE7KQ4gPo5uY7j\nvBqGwjw0fIGPjrP/JKIQqGvm/ETwlfPwVbmCsvEHbqEY+6f84TnmolgjPMnbar6Q\nSDuvqVApY7yNCEue5X0pLRAd+287VBVVvsOsZVOSj02w4PGIlsg2Y33BbcpwESzr\n4McG/dPyTRFv9mYtFPpyV50CAwEAAQ==\n-----END PUBLIC KEY-----",
_company.homepage = "https://www.aaaa.com/jp/"
session.add(_company)
# for MySQL
session.commit()
import time
time.sleep(1)
_company = Company()
_company.address = eth_account['deployer']['account_address']
_company.corporate_name = "株式会社DEMO"
_company.rsa_publickey = "-----BEGIN PUBLIC KEY-----\nMIIFIjANBgkqhkiG9w0BAQEFAAOCBQ8AMIIFCgKCBQEAtiBUQ2vdYvIqnCdUzKIC\np7jIYVtJy8KGniy6ktE0DTcYG70pFYkGDyI043meSB6Lkk0rNWaKBn3wyz4lx2oX\n3JySFyXR4vE4DNTEKS0htImO4RuK4M50v7LOfB8VphXzu9JkdVuN8LuMx6L6dhsd\nTN/aUvXULvjOy9AJekl24s44w4BgEfGj/uBYNAmiNmpM3lnIdJOg1T+4aEShHyVN\n98dv1DZ1Hh0YhMmqHqRGIzAQ6pKoly2xSVEmwBV4l2O3XEZ8ErVNgHdi6BRQrIBl\n+zQn5TysSGv5TIO1ahztUIygrzX7aEa+QnF1ROBBJ8yBW0VjjKI2Oh3wDT8ROaWb\ntB7gYQlMX9St/HJvGKaDKPDGurMFsEZeeD9Y4GWlFFkQplKIC3Kr4u6TIxcAZyG3\ntIz1IZomm/Lh9eiFiAbOMLYPdPCzh1A6uCRoJuqrNXYbE2egpLsKSkEe4VAcdaPo\nVuOXLpbDaew0cvXQR5IklHGGPPGVqQV1cmJWIqF5b1bzqziu2No+TLZceUd3N9Eh\nQIYVG4rbX2I/x2/WFeG5RHl9Zc/iSUomUqpnGY3ved61smb7uklF/7ueyj8TIm7O\ncJxhYjj+szXxV2RJyxLvSPzloQ4GDI9wd0zlya2CoYgAONJ7wm82b1LrLLhfpns2\ndSsN8htFX83p0dNn6f8ssKgA3rFbFFnBTQyFxlHO/An4qZflXtk1GsEc56g3mJFp\nrFANLpyum5mkHo9TbkL3K4mRGM1DGcLXWJwFUjDxS/OvjzDXw2dNiyrPeClvTpAb\npFfw/zqVd7ZrnTFg26bpUmM8flc6IRji49veOOMM7jMJN7mmu/pLd/Pg22oez23G\n6QsPDvqqXgjyg1NGo7natX6gyAYMpWZWOHj+Y2lffzcJYUo+wPFt/xNkAuCcDZem\nAiicfsGfniE67G1nfmwkykVwk9rTFCO8SnFei8wMpEAMYETYOS4ldavLfhY6mrF1\nItA5mlkMI84v3ROqPSp3s6F9oGYzPi5zMcgc67wIFGgaPb6i8+puui6BUbj83qOU\nKuKoQAGe9+NRnAkWSpbX07cX6XkPieTkBHEYfGaQTQOnsSs++PIk3kH5Arfjk0R5\nu1ZluzVdOXUn8D5WPfh9UFzqyXzo1HOIHxDkPejpPlNzO1w6qVQC+UiR/R2iug/U\n7StoLz476tQOwbfmnzUA6AbOKjRgN5laRoBac4BbGPJisGysOBruL7lgrw0XVtnh\nknChXfSYezxz/EtiGmO40HKAGudHDkz4gmPDkF4wlIyfDbQZOnNohz4zuOjr9Yi/\nJQVpqKxug2LXyJp38UaxL1LIT6ZyJSsaSrKAB21tsYAbksyPCVS6L6jkz8lsnlYg\nLj7lj6HQcbN8WO72+Z8Ddj/cPXJwEq4OTbtkPiPdcvSZjcBR9f3TmrQjDG0ROspt\nI/m4KhWfm7ed+eZKA1IqygFRyi6i0w6p+VbeBNgXqAiQI5GkDHqAiqv4OVyZoQB8\neunu5qM49r6bw6DJCqlg6lZDCptdKWtNBo9zgEegrJ/3oVI7x0kE7KQ4gPo5uY7j\nvBqGwjw0fIGPjrP/JKIQqGvm/ETwlfPwVbmCsvEHbqEY+6f84TnmolgjPMnbar6Q\nSDuvqVApY7yNCEue5X0pLRAd+287VBVVvsOsZVOSj02w4PGIlsg2Y33BbcpwESzr\n4McG/dPyTRFv9mYtFPpyV50CAwEAAQ==\n-----END PUBLIC KEY-----",
_company.homepage = "https://www.aaaa.com/jp/"
session.add(_company)
session.commit()
# テスト用アカウント
issuerList = [eth_account['issuer'], eth_account['deployer']]
# TokenListコントラクトアドレスの設定
token_list = TestCompanyCompanyInfoList.tokenlist_contract()
config.TOKEN_LIST_CONTRACT_ADDRESS = token_list['address']
# データ準備:新規発行(クーポン)
exchange_address = \
to_checksum_address(
shared_contract['IbetCouponExchange']['address'])
for i in range(0, 2):
attribute = TestCompanyCompanyInfoList. \
token_attribute(exchange_address)
token = issue_coupon_token(issuerList[i], attribute)
coupon_register_list(issuerList[i], token, token_list)
# 取扱トークンデータ挿入
TestCompanyCompanyInfoList.list_token(session, token)
resp = client.simulate_get(self.apiurl)
assumed_body = [
{
"address": eth_account['issuer']['account_address'],
"corporate_name": "株式会社DEMO",
"rsa_publickey": "-----BEGIN PUBLIC KEY-----\nMIIFIjANBgkqhkiG9w0BAQEFAAOCBQ8AMIIFCgKCBQEAtiBUQ2vdYvIqnCdUzKIC\np7jIYVtJy8KGniy6ktE0DTcYG70pFYkGDyI043meSB6Lkk0rNWaKBn3wyz4lx2oX\n3JySFyXR4vE4DNTEKS0htImO4RuK4M50v7LOfB8VphXzu9JkdVuN8LuMx6L6dhsd\nTN/aUvXULvjOy9AJekl24s44w4BgEfGj/uBYNAmiNmpM3lnIdJOg1T+4aEShHyVN\n98dv1DZ1Hh0YhMmqHqRGIzAQ6pKoly2xSVEmwBV4l2O3XEZ8ErVNgHdi6BRQrIBl\n+zQn5TysSGv5TIO1ahztUIygrzX7aEa+QnF1ROBBJ8yBW0VjjKI2Oh3wDT8ROaWb\ntB7gYQlMX9St/HJvGKaDKPDGurMFsEZeeD9Y4GWlFFkQplKIC3Kr4u6TIxcAZyG3\ntIz1IZomm/Lh9eiFiAbOMLYPdPCzh1A6uCRoJuqrNXYbE2egpLsKSkEe4VAcdaPo\nVuOXLpbDaew0cvXQR5IklHGGPPGVqQV1cmJWIqF5b1bzqziu2No+TLZceUd3N9Eh\nQIYVG4rbX2I/x2/WFeG5RHl9Zc/iSUomUqpnGY3ved61smb7uklF/7ueyj8TIm7O\ncJxhYjj+szXxV2RJyxLvSPzloQ4GDI9wd0zlya2CoYgAONJ7wm82b1LrLLhfpns2\ndSsN8htFX83p0dNn6f8ssKgA3rFbFFnBTQyFxlHO/An4qZflXtk1GsEc56g3mJFp\nrFANLpyum5mkHo9TbkL3K4mRGM1DGcLXWJwFUjDxS/OvjzDXw2dNiyrPeClvTpAb\npFfw/zqVd7ZrnTFg26bpUmM8flc6IRji49veOOMM7jMJN7mmu/pLd/Pg22oez23G\n6QsPDvqqXgjyg1NGo7natX6gyAYMpWZWOHj+Y2lffzcJYUo+wPFt/xNkAuCcDZem\nAiicfsGfniE67G1nfmwkykVwk9rTFCO8SnFei8wMpEAMYETYOS4ldavLfhY6mrF1\nItA5mlkMI84v3ROqPSp3s6F9oGYzPi5zMcgc67wIFGgaPb6i8+puui6BUbj83qOU\nKuKoQAGe9+NRnAkWSpbX07cX6XkPieTkBHEYfGaQTQOnsSs++PIk3kH5Arfjk0R5\nu1ZluzVdOXUn8D5WPfh9UFzqyXzo1HOIHxDkPejpPlNzO1w6qVQC+UiR/R2iug/U\n7StoLz476tQOwbfmnzUA6AbOKjRgN5laRoBac4BbGPJisGysOBruL7lgrw0XVtnh\nknChXfSYezxz/EtiGmO40HKAGudHDkz4gmPDkF4wlIyfDbQZOnNohz4zuOjr9Yi/\nJQVpqKxug2LXyJp38UaxL1LIT6ZyJSsaSrKAB21tsYAbksyPCVS6L6jkz8lsnlYg\nLj7lj6HQcbN8WO72+Z8Ddj/cPXJwEq4OTbtkPiPdcvSZjcBR9f3TmrQjDG0ROspt\nI/m4KhWfm7ed+eZKA1IqygFRyi6i0w6p+VbeBNgXqAiQI5GkDHqAiqv4OVyZoQB8\neunu5qM49r6bw6DJCqlg6lZDCptdKWtNBo9zgEegrJ/3oVI7x0kE7KQ4gPo5uY7j\nvBqGwjw0fIGPjrP/JKIQqGvm/ETwlfPwVbmCsvEHbqEY+6f84TnmolgjPMnbar6Q\nSDuvqVApY7yNCEue5X0pLRAd+287VBVVvsOsZVOSj02w4PGIlsg2Y33BbcpwESzr\n4McG/dPyTRFv9mYtFPpyV50CAwEAAQ==\n-----END PUBLIC KEY-----",
"homepage": "https://www.aaaa.com/jp/"
},
{
"address": eth_account['deployer']['account_address'],
"corporate_name": "株式会社DEMO",
"rsa_publickey": "-----BEGIN PUBLIC KEY-----\nMIIFIjANBgkqhkiG9w0BAQEFAAOCBQ8AMIIFCgKCBQEAtiBUQ2vdYvIqnCdUzKIC\np7jIYVtJy8KGniy6ktE0DTcYG70pFYkGDyI043meSB6Lkk0rNWaKBn3wyz4lx2oX\n3JySFyXR4vE4DNTEKS0htImO4RuK4M50v7LOfB8VphXzu9JkdVuN8LuMx6L6dhsd\nTN/aUvXULvjOy9AJekl24s44w4BgEfGj/uBYNAmiNmpM3lnIdJOg1T+4aEShHyVN\n98dv1DZ1Hh0YhMmqHqRGIzAQ6pKoly2xSVEmwBV4l2O3XEZ8ErVNgHdi6BRQrIBl\n+zQn5TysSGv5TIO1ahztUIygrzX7aEa+QnF1ROBBJ8yBW0VjjKI2Oh3wDT8ROaWb\ntB7gYQlMX9St/HJvGKaDKPDGurMFsEZeeD9Y4GWlFFkQplKIC3Kr4u6TIxcAZyG3\ntIz1IZomm/Lh9eiFiAbOMLYPdPCzh1A6uCRoJuqrNXYbE2egpLsKSkEe4VAcdaPo\nVuOXLpbDaew0cvXQR5IklHGGPPGVqQV1cmJWIqF5b1bzqziu2No+TLZceUd3N9Eh\nQIYVG4rbX2I/x2/WFeG5RHl9Zc/iSUomUqpnGY3ved61smb7uklF/7ueyj8TIm7O\ncJxhYjj+szXxV2RJyxLvSPzloQ4GDI9wd0zlya2CoYgAONJ7wm82b1LrLLhfpns2\ndSsN8htFX83p0dNn6f8ssKgA3rFbFFnBTQyFxlHO/An4qZflXtk1GsEc56g3mJFp\nrFANLpyum5mkHo9TbkL3K4mRGM1DGcLXWJwFUjDxS/OvjzDXw2dNiyrPeClvTpAb\npFfw/zqVd7ZrnTFg26bpUmM8flc6IRji49veOOMM7jMJN7mmu/pLd/Pg22oez23G\n6QsPDvqqXgjyg1NGo7natX6gyAYMpWZWOHj+Y2lffzcJYUo+wPFt/xNkAuCcDZem\nAiicfsGfniE67G1nfmwkykVwk9rTFCO8SnFei8wMpEAMYETYOS4ldavLfhY6mrF1\nItA5mlkMI84v3ROqPSp3s6F9oGYzPi5zMcgc67wIFGgaPb6i8+puui6BUbj83qOU\nKuKoQAGe9+NRnAkWSpbX07cX6XkPieTkBHEYfGaQTQOnsSs++PIk3kH5Arfjk0R5\nu1ZluzVdOXUn8D5WPfh9UFzqyXzo1HOIHxDkPejpPlNzO1w6qVQC+UiR/R2iug/U\n7StoLz476tQOwbfmnzUA6AbOKjRgN5laRoBac4BbGPJisGysOBruL7lgrw0XVtnh\nknChXfSYezxz/EtiGmO40HKAGudHDkz4gmPDkF4wlIyfDbQZOnNohz4zuOjr9Yi/\nJQVpqKxug2LXyJp38UaxL1LIT6ZyJSsaSrKAB21tsYAbksyPCVS6L6jkz8lsnlYg\nLj7lj6HQcbN8WO72+Z8Ddj/cPXJwEq4OTbtkPiPdcvSZjcBR9f3TmrQjDG0ROspt\nI/m4KhWfm7ed+eZKA1IqygFRyi6i0w6p+VbeBNgXqAiQI5GkDHqAiqv4OVyZoQB8\neunu5qM49r6bw6DJCqlg6lZDCptdKWtNBo9zgEegrJ/3oVI7x0kE7KQ4gPo5uY7j\nvBqGwjw0fIGPjrP/JKIQqGvm/ETwlfPwVbmCsvEHbqEY+6f84TnmolgjPMnbar6Q\nSDuvqVApY7yNCEue5X0pLRAd+287VBVVvsOsZVOSj02w4PGIlsg2Y33BbcpwESzr\n4McG/dPyTRFv9mYtFPpyV50CAwEAAQ==\n-----END PUBLIC KEY-----",
"homepage": "https://www.aaaa.com/jp/"
}
]
assert resp.status_code == 200
assert resp.json['meta'] == {'code': 200, 'message': 'OK'}
assert resp.json['data'] == assumed_body
# 正常系2: listing対象とcompanylistが突合されず0件リターン
def test_normal_2(self, client, shared_contract, mocked_company_list, session):
# テスト用アカウント
issuerList = [eth_account['issuer'], eth_account['deployer']]
# TokenListコントラクトアドレスの設定
token_list = TestCompanyCompanyInfoList.tokenlist_contract()
config.TOKEN_LIST_CONTRACT_ADDRESS = token_list['address']
# データ準備:新規発行(クーポン)
exchange_address = \
to_checksum_address(
shared_contract['IbetCouponExchange']['address'])
for i in range(0, 2):
attribute = TestCompanyCompanyInfoList. \
token_attribute(exchange_address)
token = issue_coupon_token(issuerList[i], attribute)
coupon_register_list(issuerList[i], token, token_list)
resp = client.simulate_get(self.apiurl)
assumed_body = []
assert resp.status_code == 200
assert resp.json['meta'] == {'code': 200, 'message': 'OK'}
assert resp.json['data'] == assumed_body
| 88.028436
| 1,905
| 0.820071
| 1,185
| 18,574
| 12.713924
| 0.227848
| 0.009292
| 0.008363
| 0.00916
| 0.875481
| 0.86818
| 0.862206
| 0.862206
| 0.859419
| 0.859419
| 0
| 0.099137
| 0.107731
| 18,574
| 210
| 1,906
| 88.447619
| 0.809932
| 0.048778
| 0
| 0.544218
| 0
| 0.040816
| 0.691811
| 0.62556
| 0
| 1
| 0
| 0
| 0.061224
| 1
| 0.040816
| false
| 0
| 0.068027
| 0
| 0.136054
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 11
|
bd63536a97a8490de9d6c0a13697247da486a27c
| 58,841
|
py
|
Python
|
unittests/test_units.py
|
YangyangFu/MPCPy
|
c9980cbfe7b5ea21b003c2c0bab800099dccf3f1
|
[
"BSD-3-Clause-LBNL"
] | 96
|
2017-03-31T09:59:44.000Z
|
2022-03-23T18:39:37.000Z
|
unittests/test_units.py
|
kuzha/MPCPy
|
9f78aa68236f87d39a50de54978c5064f9cc13c6
|
[
"BSD-3-Clause-LBNL"
] | 150
|
2017-03-03T17:28:34.000Z
|
2021-02-24T20:03:24.000Z
|
unittests/test_units.py
|
kuzha/MPCPy
|
9f78aa68236f87d39a50de54978c5064f9cc13c6
|
[
"BSD-3-Clause-LBNL"
] | 32
|
2017-04-24T18:22:40.000Z
|
2022-03-29T17:51:20.000Z
|
# -*- coding: utf-8 -*-
"""
This module contains the classes for testing the units of mpcpy.
"""
import unittest
from mpcpy import variables
from mpcpy import units
#%% Temperature tests
class Temperature(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Temperature';
def test_K(self):
var = variables.Static('var1', 293.15, units.K);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 293.15, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 293.15, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.K);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'K');
def test_degC(self):
var = variables.Static('var1', 20.0, units.degC);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 293.15, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 20, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.K);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'degC');
def test_degF(self):
var = variables.Static('var1', 72.0, units.degF);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 295.372, places = 3);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 72.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.K);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'degF');
def test_degR(self):
var = variables.Static('var1', 531.0, units.degR);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 295, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 531.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.K);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'degR');
#%% Power tests
class Power(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Power';
def test_W(self):
var = variables.Static('var1', 1.0, units.W);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'W');
def test_kW(self):
var = variables.Static('var1', 1.0, units.kW);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1000.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kW');
def test_MW(self):
var = variables.Static('var1', 1.0, units.MW);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1e6, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'MW');
def test_Btuh(self):
var = variables.Static('var1', 1.0, units.Btuh);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.293071, places = 6);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'Btuh');
def test_kBtuh(self):
var = variables.Static('var1', 1.0, units.kBtuh);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 293.071, places = 3);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kBtuh');
def test_hp(self):
var = variables.Static('var1', 1.0, units.hp);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 745.7, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'hp');
#%% Energy tests
class Energy(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Energy';
def test_J(self):
var = variables.Static('var1', 1.0, units.J);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'J');
def test_kJ(self):
var = variables.Static('var1', 1.0, units.kJ);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1000.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kJ');
def test_MJ(self):
var = variables.Static('var1', 1.0, units.MJ);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1000000.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'MJ');
def test_Btu(self):
var = variables.Static('var1', 1.0, units.Btu);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1055.05585, places = 5);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'Btu');
def test_kBtu(self):
var = variables.Static('var1', 1.0, units.kBtu);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1055055.85, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kBtu');
def test_Wh(self):
var = variables.Static('var1', 1.0, units.Wh);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3600, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'Wh');
def test_kWh(self):
var = variables.Static('var1', 1.0, units.kWh);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3600000, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kWh');
def test_MWh(self):
var = variables.Static('var1', 1.0, units.MWh);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3600000000, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'MWh');
#%% Power Flux tests
class PowerFlux(unittest.TestCase):
def setUp(self):
self.quantity_name = 'PowerFlux';
def test_W_m2(self):
var = variables.Static('var1', 1.0, units.W_m2);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'W/m2');
def test_kW_m2(self):
var = variables.Static('var1', 1.0, units.kW_m2);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1000.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kW/m2');
def test_W_sf(self):
var = variables.Static('var1', 1.0, units.W_sf);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 10.7639, places = 4);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'W/sf');
def test_kW_sf(self):
var = variables.Static('var1', 1.0, units.kW_sf);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 10763.9, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kW/sf');
def test_Btuh_sf(self):
var = variables.Static('var1', 1.0, units.Btuh_sf);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3.154594, places = 6);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'Btuh/sf');
def test_kBtuh_sf(self):
var = variables.Static('var1', 1.0, units.kBtuh_sf);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3154.594, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kBtuh/sf');
#%% Energy Intensity tests
class EnergyIntensity(unittest.TestCase):
def setUp(self):
self.quantity_name = 'EnergyIntensity';
def test_J_m2(self):
var = variables.Static('var1', 1.0, units.J_m2);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'J/m2');
def test_Wh_m2(self):
var = variables.Static('var1', 1.0, units.Wh_m2);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3600, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'Wh/m2');
def test_kWh_m2(self):
var = variables.Static('var1', 1.0, units.kWh_m2);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3600000, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kWh/m2');
def test_Wh_sf(self):
var = variables.Static('var1', 1.0, units.Wh_sf);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 38750.04, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'Wh/sf');
def test_kWh_sf(self):
var = variables.Static('var1', 1.0, units.kWh_sf);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 38750040, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kWh/sf');
def test_Btu_sf(self):
var = variables.Static('var1', 1.0, units.Btu_sf);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 11356.516, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'Btu/sf');
def test_kBtu_sf(self):
var = variables.Static('var1', 1.0, units.kBtu_sf);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 11356515.66, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kBtu/sf');
#%% Pressure tests
class Pressure(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Pressure';
def test_Pa(self):
var = variables.Static('var1', 1.0, units.Pa);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.Pa);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'Pa');
def test_kPa(self):
var = variables.Static('var1', 1.0, units.kPa);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1000.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.Pa);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kPa');
def test_MPa(self):
var = variables.Static('var1', 1.0, units.MPa);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1000000.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.Pa);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'MPa');
def test_bar(self):
var = variables.Static('var1', 1.0, units.bar);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 100000.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.Pa);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'bar');
def test_inwg(self):
var = variables.Static('var1', 1.0, units.inwg);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 248.84, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.Pa);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'inwg');
def test_inHg(self):
var = variables.Static('var1', 1.0, units.inHg);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3386.389, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.Pa);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'inHg');
def test_psi(self):
var = variables.Static('var1', 1.0, units.psi);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 6894.757, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.Pa);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'psi');
def test_atm(self):
var = variables.Static('var1', 1.0, units.atm);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 101325, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.Pa);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'atm');
#%% Dimensionless Ratio tests
class DimensionlessRatio(unittest.TestCase):
def setUp(self):
self.quantity_name = 'DimensionlessRatio';
def test_unit1(self):
var = variables.Static('var1', 1.0, units.unit1);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.unit1);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), '1');
def test_percent(self):
var = variables.Static('var1', 1.0, units.percent);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.01, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.unit1);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'percent');
def test_unit10(self):
var = variables.Static('var1', 1.0, units.unit10);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.1, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.unit1);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), '10');
#%% Angle tests
class Angle(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Angle';
def test_rad(self):
var = variables.Static('var1', 1.0, units.rad);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.rad);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'rad');
def test_deg(self):
var = variables.Static('var1', 1.0, units.deg);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.0174533, places = 7);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.rad);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'deg');
#%% Time tests
class Time(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Time';
def test_s(self):
var = variables.Static('var1', 1.0, units.s);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.s);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 's');
def test_minute(self):
var = variables.Static('var1', 1.0, units.minute);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 60.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.s);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'min');
def test_hour(self):
var = variables.Static('var1', 1.0, units.hour);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3600.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.s);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'h');
def test_day(self):
var = variables.Static('var1', 1.0, units.day);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 86400.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.s);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'd');
#%% Mass tests
class Mass(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Mass';
def test_kg(self):
var = variables.Static('var1', 1.0, units.kg);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.kg);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kg');
#%% Length tests
class Length(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Length';
def test_m(self):
var = variables.Static('var1', 1.0, units.m);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'm');
def test_cm(self):
var = variables.Static('var1', 1.0, units.cm);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.01, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'cm');
def test_mm(self):
var = variables.Static('var1', 1.0, units.mm);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.001, places = 3);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'mm');
def test_km(self):
var = variables.Static('var1', 1.0, units.km);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1000.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'km');
def test_inch(self):
var = variables.Static('var1', 1.0, units.inch);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.0254, places = 4);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'inch');
def test_ft(self):
var = variables.Static('var1', 1.0, units.ft);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.3048, places = 4);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'ft');
def test_yd(self):
var = variables.Static('var1', 1.0, units.yd);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.9144, places = 4);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'yd');
#%% Area tests
class Area(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Area';
def test_m2(self):
var = variables.Static('var1', 1.0, units.m2);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'm2');
def test_sf(self):
var = variables.Static('var1', 1.0, units.sf);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.092903, places = 6);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'sf');
#%% Volume tests
class Volume(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Volume';
def test_m3(self):
var = variables.Static('var1', 1.0, units.m3);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m3);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'm3');
def test_cf(self):
var = variables.Static('var1', 1.0, units.cf);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.0283168, places = 7);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m3);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'cf');
#%% Mass Flow tests
class MassFlow(unittest.TestCase):
def setUp(self):
self.quantity_name = 'MassFlow';
def test_kg_s(self):
var = variables.Static('var1', 1.0, units.kg_s);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.kg_s);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kg/s');
#%% Volumetric Flow tests
class VolumetricFlow(unittest.TestCase):
def setUp(self):
self.quantity_name = 'VolumetricFlow';
def test_m3_s(self):
var = variables.Static('var1', 1.0, units.m3_s);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m3_s);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'm3/s');
def test_cfm(self):
var = variables.Static('var1', 1.0, units.cfm);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.0004719474, places = 10);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m3_s);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'cfm');
#%% Velocity tests
class Velocity(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Velocity';
def test_m_s(self):
var = variables.Static('var1', 1.0, units.m_s);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m_s);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'm/s');
def test_mph(self):
var = variables.Static('var1', 1.0, units.mph);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.44704, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m_s);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'mph');
def test_km_h(self):
var = variables.Static('var1', 1.0, units.km_h);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 0.277778, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m_s);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'km/h');
#%% Illuminance tests
class Illuminance(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Illuminance';
def test_lx(self):
var = variables.Static('var1', 1.0, units.lx);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.lx);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'lx');
def test_fc(self):
var = variables.Static('var1', 1.0, units.fc);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 10.764, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.lx);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'fc');
#%% Luminance tests
class Luminance(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Luminance';
def test_cd_m2(self):
var = variables.Static('var1', 1.0, units.cd_m2);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.cd_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'cd/m2');
def test_nt(self):
var = variables.Static('var1', 1.0, units.nt);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.cd_m2);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'nt');
#%% EnergyPrice tests
class EnergyPrice(unittest.TestCase):
def setUp(self):
self.quantity_name = 'EnergyPrice';
def test_cents_kWh(self):
var = variables.Static('var1', 1.0, units.cents_kWh);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3.6e-8, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.dol_J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'cents/kWh');
def test_dol_kWh(self):
var = variables.Static('var1', 1.0, units.dol_kWh);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3.6e-6, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.dol_J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), '$/kWh');
def test_dol_MWh(self):
var = variables.Static('var1', 1.0, units.dol_MWh);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 3.6e-9, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.dol_J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), '$/MWh');
def test_dol_J(self):
var = variables.Static('var1', 1.0, units.dol_J);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.dol_J);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), '$/J');
#%% PowerPrice tests
class PowerPrice(unittest.TestCase):
def setUp(self):
self.quantity_name = 'PowerPrice';
def test_cents_kW(self):
var = variables.Static('var1', 1.0, units.cents_kW);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(),1e-5, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.dol_W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'cents/kW');
def test_dol_kW(self):
var = variables.Static('var1', 1.0, units.dol_kW);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1e-3, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.dol_W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), '$/kW');
def test_dol_MW(self):
var = variables.Static('var1', 1.0, units.dol_MW);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1e-6, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.dol_W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), '$/MW');
def test_dol_W(self):
var = variables.Static('var1', 1.0, units.dol_W);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.dol_W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), '$/W');
#%% SpecificHeatCapacity tests
class SpecificHeatCapacity(unittest.TestCase):
def setUp(self):
self.quantity_name = 'SpecificHeatCapacity';
def test_J_kgK(self):
var = variables.Static('var1', 1.0, units.J_kgK);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J_kgK);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'J/(kg.K)');
#%% HeatCapacity tests
class HeatCapacity(unittest.TestCase):
def setUp(self):
self.quantity_name = 'HeatCapacity';
def test_J_K(self):
var = variables.Static('var1', 1.0, units.J_K);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J_K);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'J/K');
#%% HeatCapacityCoefficient tests
class HeatCapacityCoefficient(unittest.TestCase):
def setUp(self):
self.quantity_name = 'HeatCapacityCoefficient';
def test_J_m2K(self):
var = variables.Static('var1', 1.0, units.J_m2K);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.J_m2K);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'J/(m2.K)');
#%% HeatResistance tests
class HeatResistance(unittest.TestCase):
def setUp(self):
self.quantity_name = 'HeatResistance';
def test_K_W(self):
var = variables.Static('var1', 1.0, units.K_W);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.K_W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'K/W');
#%% HeatResistance tests
class HeatResistanceCoefficient(unittest.TestCase):
def setUp(self):
self.quantity_name = 'HeatResistanceCoefficient';
def test_m2K_W(self):
var = variables.Static('var1', 1.0, units.m2K_W);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.m2K_W);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), '(m2.K)/W');
#%% HeatTransferCoefficient tests
class HeatTransferCoefficient(unittest.TestCase):
def setUp(self):
self.quantity_name = 'HeatTransferCoefficient';
def test_W_m2K(self):
var = variables.Static('var1', 1.0, units.W_m2K);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.W_m2K);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'W/(m2.K)');
#%% Density tests
class Density(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Density';
def test_kg_m3(self):
var = variables.Static('var1', 1.0, units.kg_m3);
# Test conversion to base unit
self.assertAlmostEqual(var.get_base_data(), 1.0, places = 2);
# Test conversion from base unit
self.assertAlmostEqual(var.display_data(), 1.0, places = 2);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.kg_m3);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'kg/m3');
#%% Boolean tests
class Boolean(unittest.TestCase):
def setUp(self):
self.quantity_name = 'Boolean';
def test_boolean_integer(self):
var = variables.Static('var1', 1, units.boolean_integer);
# Test conversion to base unit
self.assertEqual(var.get_base_data(), 1);
# Test conversion from base unit
self.assertEqual(var.display_data(), 1);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.boolean_integer);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'boolean_integer');
def test_boolean(self):
var = variables.Static('var1', True, units.boolean);
# Test conversion to base unit
self.assertEqual(var.get_base_data(), 1);
# Test conversion from base unit
self.assertEqual(var.display_data(), True);
# Test the base unit quantity
self.assertEqual(var.quantity_name, self.quantity_name);
# Test the base unit class
self.assertEqual(var.get_base_unit(), units.boolean_integer);
# Test the display unit name string
self.assertEqual(var.get_display_unit_name(), 'boolean');
if __name__ == '__main__':
unittest.main()
| 49.157059
| 79
| 0.624055
| 7,562
| 58,841
| 4.710394
| 0.026977
| 0.097698
| 0.133914
| 0.103762
| 0.924481
| 0.921561
| 0.919876
| 0.919876
| 0.857496
| 0.805362
| 0
| 0.024963
| 0.268826
| 58,841
| 1,197
| 80
| 49.157059
| 0.802966
| 0.251814
| 0
| 0.455587
| 0
| 0
| 0.022731
| 0.00163
| 0
| 0
| 0
| 0
| 0.623209
| 1
| 0.164756
| false
| 0
| 0.004298
| 0
| 0.209169
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
bd67b74baae72d17c5b4ea4b2b8ccaf285a221ba
| 113
|
py
|
Python
|
config.py
|
Andrew-Pei/mtcnn
|
abb5d1e60ea442ab20bfbd2c1df7b7d5488e1d46
|
[
"MIT"
] | null | null | null |
config.py
|
Andrew-Pei/mtcnn
|
abb5d1e60ea442ab20bfbd2c1df7b7d5488e1d46
|
[
"MIT"
] | null | null | null |
config.py
|
Andrew-Pei/mtcnn
|
abb5d1e60ea442ab20bfbd2c1df7b7d5488e1d46
|
[
"MIT"
] | null | null | null |
str0="2"
str1="/data1/pbw_deepfake/test/extract_face_jpg/"+str0
str2="/data1/pbw_deepfake/test/"+str0+"/**/*_jpg"
| 37.666667
| 54
| 0.734513
| 18
| 113
| 4.333333
| 0.611111
| 0.205128
| 0.410256
| 0.512821
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.072072
| 0.017699
| 113
| 3
| 55
| 37.666667
| 0.630631
| 0
| 0
| 0
| 0
| 0
| 0.675439
| 0.587719
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
da06bec9746e2406bb9f2492871cdd080cc6206d
| 25,945
|
py
|
Python
|
dfirtrack_config/tests/assignment/test_assignment_toggle.py
|
thomas-kropeit/dfirtrack
|
b1e0e659af7bc8085cfe2d269ddc651f9f4ba585
|
[
"Apache-2.0"
] | null | null | null |
dfirtrack_config/tests/assignment/test_assignment_toggle.py
|
thomas-kropeit/dfirtrack
|
b1e0e659af7bc8085cfe2d269ddc651f9f4ba585
|
[
"Apache-2.0"
] | 6
|
2022-03-16T12:30:51.000Z
|
2022-03-28T01:34:45.000Z
|
dfirtrack_config/tests/assignment/test_assignment_toggle.py
|
thomas-kropeit/dfirtrack
|
b1e0e659af7bc8085cfe2d269ddc651f9f4ba585
|
[
"Apache-2.0"
] | null | null | null |
import urllib.parse
from django.contrib.auth.models import User
from django.test import TestCase
from dfirtrack_config.models import UserConfigModel
def set_user_config_toogle_false(test_user):
"""set toggle flags in user config to false"""
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# set values
user_config.filter_assignment_view_show_artifact = False
user_config.filter_assignment_view_show_case = False
user_config.filter_assignment_view_show_note = False
user_config.filter_assignment_view_show_reportitem = False
user_config.filter_assignment_view_show_system = False
user_config.filter_assignment_view_show_tag = False
user_config.filter_assignment_view_show_task = False
# save config
user_config.save()
# return to test
return
def set_user_config_toogle_true(test_user):
"""set toggle flags in user config to true"""
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# set values
user_config.filter_assignment_view_show_artifact = True
user_config.filter_assignment_view_show_case = True
user_config.filter_assignment_view_show_note = True
user_config.filter_assignment_view_show_reportitem = True
user_config.filter_assignment_view_show_system = True
user_config.filter_assignment_view_show_tag = True
user_config.filter_assignment_view_show_task = True
# save config
user_config.save()
# return to test
return
class AssignmentToggleTestCase(TestCase):
"""assignment toggle tests"""
@classmethod
def setUpTestData(cls):
# create user
test_user = User.objects.create_user(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create config
UserConfigModel.objects.get_or_create(user_config_username=test_user)
def test_assignment_view_artifact_toggle_not_logged_in(self):
"""test toggle view"""
# create url
destination = '/login/?next=' + urllib.parse.quote(
'/config/assignment/toggle_artifact/', safe=''
)
# get response
response = self.client.get('/config/assignment/toggle_artifact/', follow=True)
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_artifact_toggle_logged_in(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/#artifact', safe='/#')
# get response
response = self.client.get('/config/assignment/toggle_artifact/')
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_artifact_toggle_redirect(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote(
'/config/assignment/toggle_artifact/', safe='/'
)
# get response
response = self.client.get('/config/assignment/toggle_artifact')
# compare
self.assertRedirects(
response, destination, status_code=301, target_status_code=302
)
def test_assignment_view_artifact_toggle_context_true(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to false
set_user_config_toogle_false(test_user)
# get response
self.client.get('/config/assignment/toggle_artifact/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertTrue(user_config.filter_assignment_view_show_artifact)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertTrue(response.context['show_artifact'])
def test_assignment_view_artifact_toggle_context_false(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to true
set_user_config_toogle_true(test_user)
# get response
self.client.get('/config/assignment/toggle_artifact/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertFalse(user_config.filter_assignment_view_show_artifact)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertFalse(response.context['show_artifact'])
def test_assignment_view_case_toggle_not_logged_in(self):
"""test toggle view"""
# create url
destination = '/login/?next=' + urllib.parse.quote(
'/config/assignment/toggle_case/', safe=''
)
# get response
response = self.client.get('/config/assignment/toggle_case/', follow=True)
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_case_toggle_logged_in(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/#case', safe='/#')
# get response
response = self.client.get('/config/assignment/toggle_case/')
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_case_toggle_redirect(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/toggle_case/', safe='/')
# get response
response = self.client.get('/config/assignment/toggle_case')
# compare
self.assertRedirects(
response, destination, status_code=301, target_status_code=302
)
def test_assignment_view_case_toggle_context_true(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to false
set_user_config_toogle_false(test_user)
# get response
self.client.get('/config/assignment/toggle_case/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertTrue(user_config.filter_assignment_view_show_case)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertTrue(response.context['show_case'])
def test_assignment_view_case_toggle_context_false(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to true
set_user_config_toogle_true(test_user)
# get response
self.client.get('/config/assignment/toggle_case/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertFalse(user_config.filter_assignment_view_show_case)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertFalse(response.context['show_case'])
def test_assignment_view_note_toggle_not_logged_in(self):
"""test toggle view"""
# create url
destination = '/login/?next=' + urllib.parse.quote(
'/config/assignment/toggle_note/', safe=''
)
# get response
response = self.client.get('/config/assignment/toggle_note/', follow=True)
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_note_toggle_logged_in(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/#note', safe='/#')
# get response
response = self.client.get('/config/assignment/toggle_note/')
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_note_toggle_redirect(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/toggle_note/', safe='/')
# get response
response = self.client.get('/config/assignment/toggle_note')
# compare
self.assertRedirects(
response, destination, status_code=301, target_status_code=302
)
def test_assignment_view_note_toggle_context_true(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to false
set_user_config_toogle_false(test_user)
# get response
self.client.get('/config/assignment/toggle_note/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertTrue(user_config.filter_assignment_view_show_note)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertTrue(response.context['show_note'])
def test_assignment_view_note_toggle_context_false(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to true
set_user_config_toogle_true(test_user)
# get response
self.client.get('/config/assignment/toggle_note/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertFalse(user_config.filter_assignment_view_show_note)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertFalse(response.context['show_note'])
def test_assignment_view_reportitem_toggle_not_logged_in(self):
"""test toggle view"""
# create url
destination = '/login/?next=' + urllib.parse.quote(
'/config/assignment/toggle_reportitem/', safe=''
)
# get response
response = self.client.get('/config/assignment/toggle_reportitem/', follow=True)
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_reportitem_toggle_logged_in(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/#reportitem', safe='/#')
# get response
response = self.client.get('/config/assignment/toggle_reportitem/')
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_reportitem_toggle_redirect(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote(
'/config/assignment/toggle_reportitem/', safe='/'
)
# get response
response = self.client.get('/config/assignment/toggle_reportitem')
# compare
self.assertRedirects(
response, destination, status_code=301, target_status_code=302
)
def test_assignment_view_reportitem_toggle_context_true(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to false
set_user_config_toogle_false(test_user)
# get response
self.client.get('/config/assignment/toggle_reportitem/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertTrue(user_config.filter_assignment_view_show_reportitem)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertTrue(response.context['show_reportitem'])
def test_assignment_view_reportitem_toggle_context_false(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to true
set_user_config_toogle_true(test_user)
# get response
self.client.get('/config/assignment/toggle_reportitem/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertFalse(user_config.filter_assignment_view_show_reportitem)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertFalse(response.context['show_reportitem'])
def test_assignment_view_system_toggle_not_logged_in(self):
"""test toggle view"""
# create url
destination = '/login/?next=' + urllib.parse.quote(
'/config/assignment/toggle_system/', safe=''
)
# get response
response = self.client.get('/config/assignment/toggle_system/', follow=True)
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_system_toggle_logged_in(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/#system', safe='/#')
# get response
response = self.client.get('/config/assignment/toggle_system/')
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_system_toggle_redirect(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/toggle_system/', safe='/')
# get response
response = self.client.get('/config/assignment/toggle_system')
# compare
self.assertRedirects(
response, destination, status_code=301, target_status_code=302
)
def test_assignment_view_system_toggle_context_true(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to false
set_user_config_toogle_false(test_user)
# get response
self.client.get('/config/assignment/toggle_system/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertTrue(user_config.filter_assignment_view_show_system)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertTrue(response.context['show_system'])
def test_assignment_view_system_toggle_context_false(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to true
set_user_config_toogle_true(test_user)
# get response
self.client.get('/config/assignment/toggle_system/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertFalse(user_config.filter_assignment_view_show_system)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertFalse(response.context['show_system'])
def test_assignment_view_tag_toggle_not_logged_in(self):
"""test toggle view"""
# create url
destination = '/login/?next=' + urllib.parse.quote(
'/config/assignment/toggle_tag/', safe=''
)
# get response
response = self.client.get('/config/assignment/toggle_tag/', follow=True)
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_tag_toggle_logged_in(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/#tag', safe='/#')
# get response
response = self.client.get('/config/assignment/toggle_tag/')
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_tag_toggle_redirect(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/toggle_tag/', safe='/')
# get response
response = self.client.get('/config/assignment/toggle_tag')
# compare
self.assertRedirects(
response, destination, status_code=301, target_status_code=302
)
def test_assignment_view_tag_toggle_context_true(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to false
set_user_config_toogle_false(test_user)
# get response
self.client.get('/config/assignment/toggle_tag/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertTrue(user_config.filter_assignment_view_show_tag)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertTrue(response.context['show_tag'])
def test_assignment_view_tag_toggle_context_false(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to true
set_user_config_toogle_true(test_user)
# get response
self.client.get('/config/assignment/toggle_tag/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertFalse(user_config.filter_assignment_view_show_tag)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertFalse(response.context['show_tag'])
def test_assignment_view_task_toggle_not_logged_in(self):
"""test toggle view"""
# create url
destination = '/login/?next=' + urllib.parse.quote(
'/config/assignment/toggle_task/', safe=''
)
# get response
response = self.client.get('/config/assignment/toggle_task/', follow=True)
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_task_toggle_logged_in(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/#task', safe='/#')
# get response
response = self.client.get('/config/assignment/toggle_task/')
# compare
self.assertRedirects(
response, destination, status_code=302, target_status_code=200
)
def test_assignment_view_task_toggle_redirect(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# create url
destination = urllib.parse.quote('/config/assignment/toggle_task/', safe='/')
# get response
response = self.client.get('/config/assignment/toggle_task')
# compare
self.assertRedirects(
response, destination, status_code=301, target_status_code=302
)
def test_assignment_view_task_toggle_context_true(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to false
set_user_config_toogle_false(test_user)
# get response
self.client.get('/config/assignment/toggle_task/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertTrue(user_config.filter_assignment_view_show_task)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertTrue(response.context['show_task'])
def test_assignment_view_task_toggle_context_false(self):
"""test toggle view"""
# login testuser
self.client.login(
username='testuser_assignment_toggle', password='KAeyjTTJP7DzWKpdhKla'
)
# get user
test_user = User.objects.get(username='testuser_assignment_toggle')
# set toggle flags in user config to true
set_user_config_toogle_true(test_user)
# get response
self.client.get('/config/assignment/toggle_task/')
# get config
user_config = UserConfigModel.objects.get(user_config_username=test_user)
# compare
self.assertFalse(user_config.filter_assignment_view_show_task)
# reload assignment view to get response context
response = self.client.get('/config/assignment/')
# compare
self.assertFalse(response.context['show_task'])
| 37.277299
| 88
| 0.659125
| 2,767
| 25,945
| 5.916516
| 0.027467
| 0.058029
| 0.065848
| 0.062855
| 0.982408
| 0.979048
| 0.975383
| 0.930426
| 0.910207
| 0.900678
| 0
| 0.007954
| 0.24895
| 25,945
| 695
| 89
| 37.330935
| 0.832187
| 0.147504
| 0
| 0.493298
| 0
| 0
| 0.183718
| 0.132818
| 0
| 0
| 0
| 0
| 0.131367
| 1
| 0.101877
| false
| 0.077748
| 0.010724
| 0
| 0.120643
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 7
|
da6c9d86f6ad200921b70c3091f8099a5f0b70de
| 45,950
|
py
|
Python
|
awswrangler/s3/_write.py
|
zacharycarter/aws-data-wrangler
|
7bae813a5a72602e441c79555b038d2db34f5c22
|
[
"Apache-2.0"
] | null | null | null |
awswrangler/s3/_write.py
|
zacharycarter/aws-data-wrangler
|
7bae813a5a72602e441c79555b038d2db34f5c22
|
[
"Apache-2.0"
] | null | null | null |
awswrangler/s3/_write.py
|
zacharycarter/aws-data-wrangler
|
7bae813a5a72602e441c79555b038d2db34f5c22
|
[
"Apache-2.0"
] | null | null | null |
"""Amazon S3 Write Module (PRIVATE)."""
import csv
import logging
import uuid
from typing import Dict, List, Optional, Tuple, Union
import boto3 # type: ignore
import pandas as pd # type: ignore
import pyarrow as pa # type: ignore
import pyarrow.lib # type: ignore
import pyarrow.parquet # type: ignore
import s3fs # type: ignore
from awswrangler import _data_types, _utils, catalog, exceptions
from awswrangler.s3._delete import delete_objects
from awswrangler.s3._read import read_parquet_metadata_internal
_COMPRESSION_2_EXT: Dict[Optional[str], str] = {None: "", "gzip": ".gz", "snappy": ".snappy"}
_logger: logging.Logger = logging.getLogger(__name__)
def _to_csv_dataset(
df: pd.DataFrame,
path: str,
index: bool,
sep: str,
fs: s3fs.S3FileSystem,
use_threads: bool,
mode: str,
dtype: Dict[str, str],
partition_cols: Optional[List[str]] = None,
boto3_session: Optional[boto3.Session] = None,
) -> Tuple[List[str], Dict[str, List[str]]]:
paths: List[str] = []
partitions_values: Dict[str, List[str]] = {}
path = path if path[-1] == "/" else f"{path}/"
if mode not in ["append", "overwrite", "overwrite_partitions"]:
raise exceptions.InvalidArgumentValue(
f"{mode} is a invalid mode, please use append, overwrite or overwrite_partitions."
)
if (mode == "overwrite") or ((mode == "overwrite_partitions") and (not partition_cols)):
delete_objects(path=path, use_threads=use_threads, boto3_session=boto3_session)
df = _data_types.cast_pandas_with_athena_types(df=df, dtype=dtype)
_logger.debug("dtypes: %s", df.dtypes)
if not partition_cols:
file_path: str = f"{path}{uuid.uuid4().hex}.csv"
_to_text(
file_format="csv",
df=df,
path=file_path,
fs=fs,
quoting=csv.QUOTE_NONE,
escapechar="\\",
header=False,
date_format="%Y-%m-%d %H:%M:%S.%f",
index=index,
sep=sep,
)
paths.append(file_path)
else:
for keys, subgroup in df.groupby(by=partition_cols, observed=True):
subgroup = subgroup.drop(partition_cols, axis="columns")
keys = (keys,) if not isinstance(keys, tuple) else keys
subdir = "/".join([f"{name}={val}" for name, val in zip(partition_cols, keys)])
prefix: str = f"{path}{subdir}/"
if mode == "overwrite_partitions":
delete_objects(path=prefix, use_threads=use_threads, boto3_session=boto3_session)
file_path = f"{prefix}{uuid.uuid4().hex}.csv"
_to_text(
file_format="csv",
df=subgroup,
path=file_path,
fs=fs,
quoting=csv.QUOTE_NONE,
escapechar="\\",
header=False,
date_format="%Y-%m-%d %H:%M:%S.%f",
index=index,
sep=sep,
)
paths.append(file_path)
partitions_values[prefix] = [str(k) for k in keys]
return paths, partitions_values
def _to_text(
file_format: str,
df: pd.DataFrame,
path: str,
fs: Optional[s3fs.S3FileSystem] = None,
boto3_session: Optional[boto3.Session] = None,
s3_additional_kwargs: Optional[Dict[str, str]] = None,
**pandas_kwargs,
) -> None:
if df.empty is True: # pragma: no cover
raise exceptions.EmptyDataFrame()
if fs is None:
fs = _utils.get_fs(session=boto3_session, s3_additional_kwargs=s3_additional_kwargs)
encoding: Optional[str] = pandas_kwargs.get("encoding", None)
newline: Optional[str] = pandas_kwargs.get("line_terminator", None)
with fs.open(path=path, mode="w", encoding=encoding, newline=newline) as f:
if file_format == "csv":
df.to_csv(f, **pandas_kwargs)
elif file_format == "json":
df.to_json(f, **pandas_kwargs)
def _to_parquet_dataset(
df: pd.DataFrame,
path: str,
index: bool,
compression: Optional[str],
compression_ext: str,
cpus: int,
fs: s3fs.S3FileSystem,
use_threads: bool,
mode: str,
dtype: Dict[str, str],
partition_cols: Optional[List[str]] = None,
boto3_session: Optional[boto3.Session] = None,
) -> Tuple[List[str], Dict[str, List[str]]]:
paths: List[str] = []
partitions_values: Dict[str, List[str]] = {}
path = path if path[-1] == "/" else f"{path}/"
if mode not in ["append", "overwrite", "overwrite_partitions"]:
raise exceptions.InvalidArgumentValue(
f"{mode} is a invalid mode, please use append, overwrite or overwrite_partitions."
)
if (mode == "overwrite") or ((mode == "overwrite_partitions") and (not partition_cols)):
delete_objects(path=path, use_threads=use_threads, boto3_session=boto3_session)
df = _data_types.cast_pandas_with_athena_types(df=df, dtype=dtype)
schema: pa.Schema = _data_types.pyarrow_schema_from_pandas(
df=df, index=index, ignore_cols=partition_cols, dtype=dtype
)
_logger.debug("schema: \n%s", schema)
if not partition_cols:
file_path: str = f"{path}{uuid.uuid4().hex}{compression_ext}.parquet"
_to_parquet_file(
df=df, schema=schema, path=file_path, index=index, compression=compression, cpus=cpus, fs=fs, dtype=dtype
)
paths.append(file_path)
else:
for keys, subgroup in df.groupby(by=partition_cols, observed=True):
subgroup = subgroup.drop(partition_cols, axis="columns")
keys = (keys,) if not isinstance(keys, tuple) else keys
subdir = "/".join([f"{name}={val}" for name, val in zip(partition_cols, keys)])
prefix: str = f"{path}{subdir}/"
if mode == "overwrite_partitions":
delete_objects(path=prefix, use_threads=use_threads, boto3_session=boto3_session)
file_path = f"{prefix}{uuid.uuid4().hex}{compression_ext}.parquet"
_to_parquet_file(
df=subgroup,
schema=schema,
path=file_path,
index=index,
compression=compression,
cpus=cpus,
fs=fs,
dtype=dtype,
)
paths.append(file_path)
partitions_values[prefix] = [str(k) for k in keys]
return paths, partitions_values
def _to_parquet_file(
df: pd.DataFrame,
path: str,
schema: pa.Schema,
index: bool,
compression: Optional[str],
cpus: int,
fs: s3fs.S3FileSystem,
dtype: Dict[str, str],
) -> str:
table: pa.Table = pyarrow.Table.from_pandas(df=df, schema=schema, nthreads=cpus, preserve_index=index, safe=True)
for col_name, col_type in dtype.items():
if col_name in table.column_names:
col_index = table.column_names.index(col_name)
pyarrow_dtype = _data_types.athena2pyarrow(col_type)
field = pa.field(name=col_name, type=pyarrow_dtype)
table = table.set_column(col_index, field, table.column(col_name).cast(pyarrow_dtype))
_logger.debug("Casting column %s (%s) to %s (%s)", col_name, col_index, col_type, pyarrow_dtype)
pyarrow.parquet.write_table(
table=table,
where=path,
write_statistics=True,
use_dictionary=True,
filesystem=fs,
coerce_timestamps="ms",
compression=compression,
flavor="spark",
)
return path
def to_csv( # pylint: disable=too-many-arguments,too-many-locals
df: pd.DataFrame,
path: str,
sep: str = ",",
index: bool = True,
columns: Optional[List[str]] = None,
use_threads: bool = True,
boto3_session: Optional[boto3.Session] = None,
s3_additional_kwargs: Optional[Dict[str, str]] = None,
sanitize_columns: bool = False,
dataset: bool = False,
partition_cols: Optional[List[str]] = None,
mode: Optional[str] = None,
catalog_versioning: bool = False,
database: Optional[str] = None,
table: Optional[str] = None,
dtype: Optional[Dict[str, str]] = None,
description: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
columns_comments: Optional[Dict[str, str]] = None,
regular_partitions: bool = True,
projection_enabled: bool = False,
projection_types: Optional[Dict[str, str]] = None,
projection_ranges: Optional[Dict[str, str]] = None,
projection_values: Optional[Dict[str, str]] = None,
projection_intervals: Optional[Dict[str, str]] = None,
projection_digits: Optional[Dict[str, str]] = None,
**pandas_kwargs,
) -> Dict[str, Union[List[str], Dict[str, List[str]]]]:
"""Write CSV file or dataset on Amazon S3.
The concept of Dataset goes beyond the simple idea of files and enable more
complex features like partitioning, casting and catalog integration (Amazon Athena/AWS Glue Catalog).
Note
----
If `dataset=True` The table name and all column names will be automatically sanitized using
`wr.catalog.sanitize_table_name` and `wr.catalog.sanitize_column_name`.
Please, pass `sanitize_columns=True` to force the same behaviour for `dataset=False`.
Note
----
If `dataset=True`, `pandas_kwargs` will be ignored due
restrictive quoting, date_format, escapechar, encoding, etc required by Athena/Glue Catalog.
Note
----
By now Pandas does not support in-memory CSV compression.
https://github.com/pandas-dev/pandas/issues/22555
So the `compression` will not be supported on Wrangler too.
Note
----
On `append` mode, the `parameters` will be upsert on an existing table.
Note
----
In case of `use_threads=True` the number of threads that will be spawned will be get from os.cpu_count().
Parameters
----------
df: pandas.DataFrame
Pandas DataFrame https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html
path : str
Amazon S3 path (e.g. s3://bucket/filename.csv).
sep : str
String of length 1. Field delimiter for the output file.
index : bool
Write row names (index).
columns : List[str], optional
Columns to write.
use_threads : bool
True to enable concurrent requests, False to disable multiple threads.
If enabled os.cpu_count() will be used as the max number of threads.
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 Session will be used if boto3_session receive None.
s3_additional_kwargs:
Forward to s3fs, useful for server side encryption
https://s3fs.readthedocs.io/en/latest/#serverside-encryption
sanitize_columns : bool
True to sanitize columns names or False to keep it as is.
True value is forced if `dataset=True`.
dataset : bool
If True store a parquet dataset instead of a single file.
If True, enable all follow arguments:
partition_cols, mode, database, table, description, parameters, columns_comments, .
partition_cols: List[str], optional
List of column names that will be used to create partitions. Only takes effect if dataset=True.
mode : str, optional
``append`` (Default), ``overwrite``, ``overwrite_partitions``. Only takes effect if dataset=True.
catalog_versioning : bool
If True and `mode="overwrite"`, creates an archived version of the table catalog before updating it.
database : str, optional
Glue/Athena catalog: Database name.
table : str, optional
Glue/Athena catalog: Table name.
dtype : Dict[str, str], optional
Dictionary of columns names and Athena/Glue types to be casted.
Useful when you have columns with undetermined or mixed data types.
(e.g. {'col name': 'bigint', 'col2 name': 'int'})
description : str, optional
Glue/Athena catalog: Table description
parameters : Dict[str, str], optional
Glue/Athena catalog: Key/value pairs to tag the table.
columns_comments : Dict[str, str], optional
Glue/Athena catalog:
Columns names and the related comments (e.g. {'col0': 'Column 0.', 'col1': 'Column 1.', 'col2': 'Partition.'}).
regular_partitions : bool
Create regular partitions (Non projected partitions) on Glue Catalog.
Disable when you will work only with Partition Projection.
Keep enabled even when working with projections is useful to keep
Redshift Spectrum working with the regular partitions.
projection_enabled : bool
Enable Partition Projection on Athena (https://docs.aws.amazon.com/athena/latest/ug/partition-projection.html)
projection_types : Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections types.
Valid types: "enum", "integer", "date", "injected"
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': 'enum', 'col2_name': 'integer'})
projection_ranges: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections ranges.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': '0,10', 'col2_name': '-1,8675309'})
projection_values: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections values.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': 'A,B,Unknown', 'col2_name': 'foo,boo,bar'})
projection_intervals: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections intervals.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': '1', 'col2_name': '5'})
projection_digits: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections digits.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': '1', 'col2_name': '2'})
pandas_kwargs :
keyword arguments forwarded to pandas.DataFrame.to_csv()
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html
Returns
-------
None
None.
Examples
--------
Writing single file
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_csv(
... df=pd.DataFrame({'col': [1, 2, 3]}),
... path='s3://bucket/prefix/my_file.csv',
... )
{
'paths': ['s3://bucket/prefix/my_file.csv'],
'partitions_values': {}
}
Writing single file encrypted with a KMS key
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_csv(
... df=pd.DataFrame({'col': [1, 2, 3]}),
... path='s3://bucket/prefix/my_file.csv',
... s3_additional_kwargs={
... 'ServerSideEncryption': 'aws:kms',
... 'SSEKMSKeyId': 'YOUR_KMY_KEY_ARN'
... }
... )
{
'paths': ['s3://bucket/prefix/my_file.csv'],
'partitions_values': {}
}
Writing partitioned dataset
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_csv(
... df=pd.DataFrame({
... 'col': [1, 2, 3],
... 'col2': ['A', 'A', 'B']
... }),
... path='s3://bucket/prefix',
... dataset=True,
... partition_cols=['col2']
... )
{
'paths': ['s3://.../col2=A/x.csv', 's3://.../col2=B/y.csv'],
'partitions_values: {
's3://.../col2=A/': ['A'],
's3://.../col2=B/': ['B']
}
}
Writing dataset to S3 with metadata on Athena/Glue Catalog.
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_csv(
... df=pd.DataFrame({
... 'col': [1, 2, 3],
... 'col2': ['A', 'A', 'B']
... }),
... path='s3://bucket/prefix',
... dataset=True,
... partition_cols=['col2'],
... database='default', # Athena/Glue database
... table='my_table' # Athena/Glue table
... )
{
'paths': ['s3://.../col2=A/x.csv', 's3://.../col2=B/y.csv'],
'partitions_values: {
's3://.../col2=A/': ['A'],
's3://.../col2=B/': ['B']
}
}
Writing dataset casting empty column data type
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_csv(
... df=pd.DataFrame({
... 'col': [1, 2, 3],
... 'col2': ['A', 'A', 'B'],
... 'col3': [None, None, None]
... }),
... path='s3://bucket/prefix',
... dataset=True,
... database='default', # Athena/Glue database
... table='my_table' # Athena/Glue table
... dtype={'col3': 'date'}
... )
{
'paths': ['s3://.../x.csv'],
'partitions_values: {}
}
"""
if (database is None) ^ (table is None):
raise exceptions.InvalidArgumentCombination(
"Please pass database and table arguments to be able to store the metadata into the Athena/Glue Catalog."
)
if df.empty is True:
raise exceptions.EmptyDataFrame()
partition_cols = partition_cols if partition_cols else []
dtype = dtype if dtype else {}
partitions_values: Dict[str, List[str]] = {}
# Sanitize table to respect Athena's standards
if (sanitize_columns is True) or (dataset is True):
df = catalog.sanitize_dataframe_columns_names(df=df)
partition_cols = [catalog.sanitize_column_name(p) for p in partition_cols]
dtype = {catalog.sanitize_column_name(k): v.lower() for k, v in dtype.items()}
catalog.drop_duplicated_columns(df=df)
session: boto3.Session = _utils.ensure_session(session=boto3_session)
fs: s3fs.S3FileSystem = _utils.get_fs(session=session, s3_additional_kwargs=s3_additional_kwargs)
if dataset is False:
if partition_cols:
raise exceptions.InvalidArgumentCombination("Please, pass dataset=True to be able to use partition_cols.")
if mode is not None:
raise exceptions.InvalidArgumentCombination("Please pass dataset=True to be able to use mode.")
if columns_comments:
raise exceptions.InvalidArgumentCombination("Please pass dataset=True to be able to use columns_comments.")
if any(arg is not None for arg in (database, table, description, parameters)):
raise exceptions.InvalidArgumentCombination(
"Please pass dataset=True to be able to use any one of these "
"arguments: database, table, description, parameters, "
"columns_comments."
)
pandas_kwargs["sep"] = sep
pandas_kwargs["index"] = index
pandas_kwargs["columns"] = columns
_to_text(file_format="csv", df=df, path=path, fs=fs, **pandas_kwargs)
paths = [path]
else:
mode = "append" if mode is None else mode
if columns:
df = df[columns]
if (
(mode in ("append", "overwrite_partitions")) and (database is not None) and (table is not None)
): # Fetching Catalog Types
catalog_types: Optional[Dict[str, str]] = catalog.get_table_types(
database=database, table=table, boto3_session=session
)
if catalog_types is not None:
for k, v in catalog_types.items():
dtype[k] = v
paths, partitions_values = _to_csv_dataset(
df=df,
path=path,
index=index,
sep=sep,
fs=fs,
use_threads=use_threads,
partition_cols=partition_cols,
dtype=dtype,
mode=mode,
boto3_session=session,
)
if (database is not None) and (table is not None):
columns_types, partitions_types = _data_types.athena_types_from_pandas_partitioned(
df=df, index=index, partition_cols=partition_cols, dtype=dtype, index_left=True
)
catalog.create_csv_table(
database=database,
table=table,
path=path,
columns_types=columns_types,
partitions_types=partitions_types,
description=description,
parameters=parameters,
columns_comments=columns_comments,
boto3_session=session,
mode=mode,
catalog_versioning=catalog_versioning,
sep=sep,
projection_enabled=projection_enabled,
projection_types=projection_types,
projection_ranges=projection_ranges,
projection_values=projection_values,
projection_intervals=projection_intervals,
projection_digits=projection_digits,
)
if partitions_values and (regular_partitions is True):
_logger.debug("partitions_values:\n%s", partitions_values)
catalog.add_csv_partitions(
database=database, table=table, partitions_values=partitions_values, boto3_session=session, sep=sep
)
return {"paths": paths, "partitions_values": partitions_values}
def to_json(
df: pd.DataFrame,
path: str,
boto3_session: Optional[boto3.Session] = None,
s3_additional_kwargs: Optional[Dict[str, str]] = None,
**pandas_kwargs,
) -> None:
"""Write JSON file on Amazon S3.
Parameters
----------
df: pandas.DataFrame
Pandas DataFrame https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html
path : str
Amazon S3 path (e.g. s3://bucket/filename.csv).
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 Session will be used if boto3_session receive None.
s3_additional_kwargs:
Forward to s3fs, useful for server side encryption
https://s3fs.readthedocs.io/en/latest/#serverside-encryption
pandas_kwargs:
keyword arguments forwarded to pandas.DataFrame.to_csv()
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_json.html
Returns
-------
None
None.
Examples
--------
Writing JSON file
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_json(
... df=pd.DataFrame({'col': [1, 2, 3]}),
... path='s3://bucket/filename.json',
... )
Writing CSV file encrypted with a KMS key
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_json(
... df=pd.DataFrame({'col': [1, 2, 3]}),
... path='s3://bucket/filename.json',
... s3_additional_kwargs={
... 'ServerSideEncryption': 'aws:kms',
... 'SSEKMSKeyId': 'YOUR_KMY_KEY_ARN'
... }
... )
"""
return _to_text(
file_format="json",
df=df,
path=path,
boto3_session=boto3_session,
s3_additional_kwargs=s3_additional_kwargs,
**pandas_kwargs,
)
def to_parquet( # pylint: disable=too-many-arguments,too-many-locals
df: pd.DataFrame,
path: str,
index: bool = False,
compression: Optional[str] = "snappy",
use_threads: bool = True,
boto3_session: Optional[boto3.Session] = None,
s3_additional_kwargs: Optional[Dict[str, str]] = None,
sanitize_columns: bool = False,
dataset: bool = False,
partition_cols: Optional[List[str]] = None,
mode: Optional[str] = None,
catalog_versioning: bool = False,
database: Optional[str] = None,
table: Optional[str] = None,
dtype: Optional[Dict[str, str]] = None,
description: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
columns_comments: Optional[Dict[str, str]] = None,
regular_partitions: bool = True,
projection_enabled: bool = False,
projection_types: Optional[Dict[str, str]] = None,
projection_ranges: Optional[Dict[str, str]] = None,
projection_values: Optional[Dict[str, str]] = None,
projection_intervals: Optional[Dict[str, str]] = None,
projection_digits: Optional[Dict[str, str]] = None,
) -> Dict[str, Union[List[str], Dict[str, List[str]]]]:
"""Write Parquet file or dataset on Amazon S3.
The concept of Dataset goes beyond the simple idea of files and enable more
complex features like partitioning, casting and catalog integration (Amazon Athena/AWS Glue Catalog).
Note
----
If `dataset=True` The table name and all column names will be automatically sanitized using
`wr.catalog.sanitize_table_name` and `wr.catalog.sanitize_column_name`.
Please, pass `sanitize_columns=True` to force the same behaviour for `dataset=False`.
Note
----
On `append` mode, the `parameters` will be upsert on an existing table.
Note
----
In case of `use_threads=True` the number of threads that will be spawned will be get from os.cpu_count().
Parameters
----------
df: pandas.DataFrame
Pandas DataFrame https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html
path : str
S3 path (for file e.g. ``s3://bucket/prefix/filename.parquet``) (for dataset e.g. ``s3://bucket/prefix``).
index : bool
True to store the DataFrame index in file, otherwise False to ignore it.
compression: str, optional
Compression style (``None``, ``snappy``, ``gzip``).
use_threads : bool
True to enable concurrent requests, False to disable multiple threads.
If enabled os.cpu_count() will be used as the max number of threads.
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
s3_additional_kwargs:
Forward to s3fs, useful for server side encryption
https://s3fs.readthedocs.io/en/latest/#serverside-encryption
sanitize_columns : bool
True to sanitize columns names or False to keep it as is.
True value is forced if `dataset=True`.
dataset : bool
If True store a parquet dataset instead of a single file.
If True, enable all follow arguments:
partition_cols, mode, database, table, description, parameters, columns_comments, .
partition_cols: List[str], optional
List of column names that will be used to create partitions. Only takes effect if dataset=True.
mode: str, optional
``append`` (Default), ``overwrite``, ``overwrite_partitions``. Only takes effect if dataset=True.
catalog_versioning : bool
If True and `mode="overwrite"`, creates an archived version of the table catalog before updating it.
database : str, optional
Glue/Athena catalog: Database name.
table : str, optional
Glue/Athena catalog: Table name.
dtype : Dict[str, str], optional
Dictionary of columns names and Athena/Glue types to be casted.
Useful when you have columns with undetermined or mixed data types.
(e.g. {'col name': 'bigint', 'col2 name': 'int'})
description : str, optional
Glue/Athena catalog: Table description
parameters : Dict[str, str], optional
Glue/Athena catalog: Key/value pairs to tag the table.
columns_comments : Dict[str, str], optional
Glue/Athena catalog:
Columns names and the related comments (e.g. {'col0': 'Column 0.', 'col1': 'Column 1.', 'col2': 'Partition.'}).
regular_partitions : bool
Create regular partitions (Non projected partitions) on Glue Catalog.
Disable when you will work only with Partition Projection.
Keep enabled even when working with projections is useful to keep
Redshift Spectrum working with the regular partitions.
projection_enabled : bool
Enable Partition Projection on Athena (https://docs.aws.amazon.com/athena/latest/ug/partition-projection.html)
projection_types : Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections types.
Valid types: "enum", "integer", "date", "injected"
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': 'enum', 'col2_name': 'integer'})
projection_ranges: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections ranges.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': '0,10', 'col2_name': '-1,8675309'})
projection_values: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections values.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': 'A,B,Unknown', 'col2_name': 'foo,boo,bar'})
projection_intervals: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections intervals.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': '1', 'col2_name': '5'})
projection_digits: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections digits.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': '1', 'col2_name': '2'})
Returns
-------
Dict[str, Union[List[str], Dict[str, List[str]]]]
Dictionary with:
'paths': List of all stored files paths on S3.
'partitions_values': Dictionary of partitions added with keys as S3 path locations
and values as a list of partitions values as str.
Examples
--------
Writing single file
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_parquet(
... df=pd.DataFrame({'col': [1, 2, 3]}),
... path='s3://bucket/prefix/my_file.parquet',
... )
{
'paths': ['s3://bucket/prefix/my_file.parquet'],
'partitions_values': {}
}
Writing single file encrypted with a KMS key
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_parquet(
... df=pd.DataFrame({'col': [1, 2, 3]}),
... path='s3://bucket/prefix/my_file.parquet',
... s3_additional_kwargs={
... 'ServerSideEncryption': 'aws:kms',
... 'SSEKMSKeyId': 'YOUR_KMY_KEY_ARN'
... }
... )
{
'paths': ['s3://bucket/prefix/my_file.parquet'],
'partitions_values': {}
}
Writing partitioned dataset
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_parquet(
... df=pd.DataFrame({
... 'col': [1, 2, 3],
... 'col2': ['A', 'A', 'B']
... }),
... path='s3://bucket/prefix',
... dataset=True,
... partition_cols=['col2']
... )
{
'paths': ['s3://.../col2=A/x.parquet', 's3://.../col2=B/y.parquet'],
'partitions_values: {
's3://.../col2=A/': ['A'],
's3://.../col2=B/': ['B']
}
}
Writing dataset to S3 with metadata on Athena/Glue Catalog.
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_parquet(
... df=pd.DataFrame({
... 'col': [1, 2, 3],
... 'col2': ['A', 'A', 'B']
... }),
... path='s3://bucket/prefix',
... dataset=True,
... partition_cols=['col2'],
... database='default', # Athena/Glue database
... table='my_table' # Athena/Glue table
... )
{
'paths': ['s3://.../col2=A/x.parquet', 's3://.../col2=B/y.parquet'],
'partitions_values: {
's3://.../col2=A/': ['A'],
's3://.../col2=B/': ['B']
}
}
Writing dataset casting empty column data type
>>> import awswrangler as wr
>>> import pandas as pd
>>> wr.s3.to_parquet(
... df=pd.DataFrame({
... 'col': [1, 2, 3],
... 'col2': ['A', 'A', 'B'],
... 'col3': [None, None, None]
... }),
... path='s3://bucket/prefix',
... dataset=True,
... database='default', # Athena/Glue database
... table='my_table' # Athena/Glue table
... dtype={'col3': 'date'}
... )
{
'paths': ['s3://.../x.parquet'],
'partitions_values: {}
}
"""
if (database is None) ^ (table is None):
raise exceptions.InvalidArgumentCombination(
"Please pass database and table arguments to be able to store the metadata into the Athena/Glue Catalog."
)
if df.empty is True:
raise exceptions.EmptyDataFrame()
partition_cols = partition_cols if partition_cols else []
dtype = dtype if dtype else {}
partitions_values: Dict[str, List[str]] = {}
# Sanitize table to respect Athena's standards
if (sanitize_columns is True) or (dataset is True):
df = catalog.sanitize_dataframe_columns_names(df=df)
partition_cols = [catalog.sanitize_column_name(p) for p in partition_cols]
dtype = {catalog.sanitize_column_name(k): v.lower() for k, v in dtype.items()}
catalog.drop_duplicated_columns(df=df)
session: boto3.Session = _utils.ensure_session(session=boto3_session)
cpus: int = _utils.ensure_cpu_count(use_threads=use_threads)
fs: s3fs.S3FileSystem = _utils.get_fs(session=session, s3_additional_kwargs=s3_additional_kwargs)
compression_ext: Optional[str] = _COMPRESSION_2_EXT.get(compression, None)
if compression_ext is None:
raise exceptions.InvalidCompression(f"{compression} is invalid, please use None, snappy or gzip.")
if dataset is False:
if path.endswith("/"): # pragma: no cover
raise exceptions.InvalidArgumentValue(
"If <dataset=False>, the argument <path> should be a object path, not a directory."
)
if partition_cols:
raise exceptions.InvalidArgumentCombination("Please, pass dataset=True to be able to use partition_cols.")
if mode is not None:
raise exceptions.InvalidArgumentCombination("Please pass dataset=True to be able to use mode.")
if any(arg is not None for arg in (database, table, description, parameters)):
raise exceptions.InvalidArgumentCombination(
"Please pass dataset=True to be able to use any one of these "
"arguments: database, table, description, parameters, "
"columns_comments."
)
df = _data_types.cast_pandas_with_athena_types(df=df, dtype=dtype)
schema: pa.Schema = _data_types.pyarrow_schema_from_pandas(
df=df, index=index, ignore_cols=partition_cols, dtype=dtype
)
_logger.debug("schema: \n%s", schema)
paths = [
_to_parquet_file(
df=df, path=path, schema=schema, index=index, compression=compression, cpus=cpus, fs=fs, dtype=dtype
)
]
else:
mode = "append" if mode is None else mode
if (
(mode in ("append", "overwrite_partitions")) and (database is not None) and (table is not None)
): # Fetching Catalog Types
catalog_types: Optional[Dict[str, str]] = catalog.get_table_types(
database=database, table=table, boto3_session=session
)
if catalog_types is not None:
for k, v in catalog_types.items():
dtype[k] = v
paths, partitions_values = _to_parquet_dataset(
df=df,
path=path,
index=index,
compression=compression,
compression_ext=compression_ext,
cpus=cpus,
fs=fs,
use_threads=use_threads,
partition_cols=partition_cols,
dtype=dtype,
mode=mode,
boto3_session=session,
)
if (database is not None) and (table is not None):
columns_types, partitions_types = _data_types.athena_types_from_pandas_partitioned(
df=df, index=index, partition_cols=partition_cols, dtype=dtype
)
catalog.create_parquet_table(
database=database,
table=table,
path=path,
columns_types=columns_types,
partitions_types=partitions_types,
compression=compression,
description=description,
parameters=parameters,
columns_comments=columns_comments,
boto3_session=session,
mode=mode,
catalog_versioning=catalog_versioning,
projection_enabled=projection_enabled,
projection_types=projection_types,
projection_ranges=projection_ranges,
projection_values=projection_values,
projection_intervals=projection_intervals,
projection_digits=projection_digits,
)
if partitions_values and (regular_partitions is True):
_logger.debug("partitions_values:\n%s", partitions_values)
catalog.add_parquet_partitions(
database=database,
table=table,
partitions_values=partitions_values,
compression=compression,
boto3_session=session,
)
return {"paths": paths, "partitions_values": partitions_values}
def store_parquet_metadata( # pylint: disable=too-many-arguments
path: str,
database: str,
table: str,
dtype: Optional[Dict[str, str]] = None,
sampling: float = 1.0,
dataset: bool = False,
path_suffix: Optional[str] = None,
use_threads: bool = True,
description: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
columns_comments: Optional[Dict[str, str]] = None,
compression: Optional[str] = None,
mode: str = "overwrite",
catalog_versioning: bool = False,
regular_partitions: bool = True,
projection_enabled: bool = False,
projection_types: Optional[Dict[str, str]] = None,
projection_ranges: Optional[Dict[str, str]] = None,
projection_values: Optional[Dict[str, str]] = None,
projection_intervals: Optional[Dict[str, str]] = None,
projection_digits: Optional[Dict[str, str]] = None,
boto3_session: Optional[boto3.Session] = None,
) -> Tuple[Dict[str, str], Optional[Dict[str, str]], Optional[Dict[str, List[str]]]]:
"""Infer and store parquet metadata on AWS Glue Catalog.
Infer Apache Parquet file(s) metadata from from a received S3 prefix or list of S3 objects paths
And then stores it on AWS Glue Catalog including all inferred partitions
(No need of 'MCSK REPAIR TABLE')
The concept of Dataset goes beyond the simple idea of files and enable more
complex features like partitioning and catalog integration (AWS Glue Catalog).
Note
----
On `append` mode, the `parameters` will be upsert on an existing table.
Note
----
In case of `use_threads=True` the number of threads that will be spawned will be get from os.cpu_count().
Parameters
----------
path : Union[str, List[str]]
S3 prefix (e.g. s3://bucket/prefix) or list of S3 objects paths (e.g. [s3://bucket/key0, s3://bucket/key1]).
database : str
Glue/Athena catalog: Database name.
table : str
Glue/Athena catalog: Table name.
dtype : Dict[str, str], optional
Dictionary of columns names and Athena/Glue types to be casted.
Useful when you have columns with undetermined data types as partitions columns.
(e.g. {'col name': 'bigint', 'col2 name': 'int'})
sampling : float
Random sample ratio of files that will have the metadata inspected.
Must be `0.0 < sampling <= 1.0`.
The higher, the more accurate.
The lower, the faster.
dataset: bool
If True read a parquet dataset instead of simple file(s) loading all the related partitions as columns.
use_threads : bool
True to enable concurrent requests, False to disable multiple threads.
If enabled os.cpu_count() will be used as the max number of threads.
description: str, optional
Glue/Athena catalog: Table description
parameters: Dict[str, str], optional
Glue/Athena catalog: Key/value pairs to tag the table.
columns_comments: Dict[str, str], optional
Glue/Athena catalog:
Columns names and the related comments (e.g. {'col0': 'Column 0.', 'col1': 'Column 1.', 'col2': 'Partition.'}).
compression: str, optional
Compression style (``None``, ``snappy``, ``gzip``, etc).
mode: str
'overwrite' to recreate any possible existing table or 'append' to keep any possible existing table.
catalog_versioning : bool
If True and `mode="overwrite"`, creates an archived version of the table catalog before updating it.
regular_partitions : bool
Create regular partitions (Non projected partitions) on Glue Catalog.
Disable when you will work only with Partition Projection.
Keep enabled even when working with projections is useful to keep
Redshift Spectrum working with the regular partitions.
projection_enabled : bool
Enable Partition Projection on Athena (https://docs.aws.amazon.com/athena/latest/ug/partition-projection.html)
projection_types : Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections types.
Valid types: "enum", "integer", "date", "injected"
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': 'enum', 'col2_name': 'integer'})
projection_ranges: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections ranges.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': '0,10', 'col2_name': '-1,8675309'})
projection_values: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections values.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': 'A,B,Unknown', 'col2_name': 'foo,boo,bar'})
projection_intervals: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections intervals.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': '1', 'col2_name': '5'})
projection_digits: Optional[Dict[str, str]]
Dictionary of partitions names and Athena projections digits.
https://docs.aws.amazon.com/athena/latest/ug/partition-projection-supported-types.html
(e.g. {'col_name': '1', 'col2_name': '2'})
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
Returns
-------
Tuple[Dict[str, str], Optional[Dict[str, str]], Optional[Dict[str, List[str]]]]
The metadata used to create the Glue Table.
columns_types: Dictionary with keys as column names and vales as
data types (e.g. {'col0': 'bigint', 'col1': 'double'}). /
partitions_types: Dictionary with keys as partition names
and values as data types (e.g. {'col2': 'date'}). /
partitions_values: Dictionary with keys as S3 path locations and values as a
list of partitions values as str (e.g. {'s3://bucket/prefix/y=2020/m=10/': ['2020', '10']}).
Examples
--------
Reading all Parquet files metadata under a prefix
>>> import awswrangler as wr
>>> columns_types, partitions_types, partitions_values = wr.s3.store_parquet_metadata(
... path='s3://bucket/prefix/',
... database='...',
... table='...',
... dataset=True
... )
"""
session: boto3.Session = _utils.ensure_session(session=boto3_session)
columns_types: Dict[str, str]
partitions_types: Optional[Dict[str, str]]
partitions_values: Optional[Dict[str, List[str]]]
columns_types, partitions_types, partitions_values = read_parquet_metadata_internal(
path=path,
dtype=dtype,
sampling=sampling,
dataset=dataset,
path_suffix=path_suffix,
use_threads=use_threads,
boto3_session=session,
)
_logger.debug("columns_types: %s", columns_types)
_logger.debug("partitions_types: %s", partitions_types)
_logger.debug("partitions_values: %s", partitions_values)
catalog.create_parquet_table(
database=database,
table=table,
path=path,
columns_types=columns_types,
partitions_types=partitions_types,
description=description,
parameters=parameters,
columns_comments=columns_comments,
mode=mode,
catalog_versioning=catalog_versioning,
projection_enabled=projection_enabled,
projection_types=projection_types,
projection_ranges=projection_ranges,
projection_values=projection_values,
projection_intervals=projection_intervals,
projection_digits=projection_digits,
boto3_session=session,
)
if (partitions_types is not None) and (partitions_values is not None) and (regular_partitions is True):
catalog.add_parquet_partitions(
database=database,
table=table,
partitions_values=partitions_values,
compression=compression,
boto3_session=session,
)
return columns_types, partitions_types, partitions_values
| 41.321942
| 119
| 0.626899
| 5,578
| 45,950
| 5.040337
| 0.072427
| 0.01942
| 0.022408
| 0.030731
| 0.852036
| 0.829984
| 0.818922
| 0.812662
| 0.801031
| 0.790254
| 0
| 0.010388
| 0.254211
| 45,950
| 1,111
| 120
| 41.359136
| 0.810032
| 0.472252
| 0
| 0.719844
| 0
| 0.001946
| 0.084529
| 0.011012
| 0
| 0
| 0
| 0
| 0
| 1
| 0.015564
| false
| 0.01751
| 0.025292
| 0
| 0.054475
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
16f1c6cc1e118e4a3fbf7a0d16571e61a1c4a39e
| 90
|
py
|
Python
|
pymicrofluidics/pymicrofluidics/__init__.py
|
julou/PyMicrofluidics
|
0934861e49b7abc85d965ebf7d6b1d2bec050343
|
[
"MIT"
] | null | null | null |
pymicrofluidics/pymicrofluidics/__init__.py
|
julou/PyMicrofluidics
|
0934861e49b7abc85d965ebf7d6b1d2bec050343
|
[
"MIT"
] | 3
|
2018-03-22T10:44:48.000Z
|
2021-06-10T14:11:01.000Z
|
pymicrofluidics/pymicrofluidics/__init__.py
|
julou/PyMicrofluidics
|
0934861e49b7abc85d965ebf7d6b1d2bec050343
|
[
"MIT"
] | 2
|
2018-03-22T10:36:57.000Z
|
2018-03-22T10:39:54.000Z
|
#import pymicrofluidics.microfluidics_class
#import pymicrofluidics.microfluidics_plotting
| 45
| 46
| 0.922222
| 8
| 90
| 10.125
| 0.625
| 0.518519
| 0.839506
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.033333
| 90
| 2
| 46
| 45
| 0.931034
| 0.966667
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 1
| null | 1
| 1
| 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
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
e50040262f66f9ad4d170d2fce353c033bd67032
| 9,021
|
py
|
Python
|
tests/test_triggers.py
|
syseleven/rebootmgr
|
681a98efbc2472ef6587cacf8eb813a711b750e2
|
[
"MIT"
] | 11
|
2018-11-14T11:14:59.000Z
|
2021-08-03T07:54:24.000Z
|
tests/test_triggers.py
|
syseleven/rebootmgr
|
681a98efbc2472ef6587cacf8eb813a711b750e2
|
[
"MIT"
] | 9
|
2018-11-14T10:20:57.000Z
|
2020-03-17T12:38:25.000Z
|
tests/test_triggers.py
|
syseleven/rebootmgr
|
681a98efbc2472ef6587cacf8eb813a711b750e2
|
[
"MIT"
] | 3
|
2019-02-07T11:34:38.000Z
|
2019-02-08T13:02:00.000Z
|
from rebootmgr.main import cli as rebootmgr
import datetime
import pytest
import socket
def test_reboot_not_required(run_cli, forward_consul_port, default_config, reboot_task):
result = run_cli(rebootmgr, ["-v", "--check-triggers"])
assert "No reboot necessary" in result.output
assert result.exit_code == 0
def test_reboot_required_because_consul(
run_cli, forward_consul_port, consul_cluster, default_config,
reboot_task, mock_subprocess_run, mocker):
consul_cluster[0].kv.put("service/rebootmgr/nodes/%s/reboot_required" % socket.gethostname(), "")
mocked_sleep = mocker.patch("time.sleep")
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
result = run_cli(rebootmgr, ["-v", "--check-triggers"])
mocked_sleep.assert_any_call(130)
mocked_run.assert_any_call(["shutdown", "-r", "+1"], check=True)
assert "Reboot now ..." in result.output
assert result.exit_code == 0
def test_reboot_required_because_consul_but_removed_after_sleep(
run_cli, forward_consul_port, consul_cluster, default_config,
reboot_task, mock_subprocess_run, mocker):
consul_cluster[0].kv.put("service/rebootmgr/nodes/%s/reboot_required" % socket.gethostname(), "")
def remove_reboot_required(seconds):
if seconds == 130:
consul_cluster[0].kv.delete("service/rebootmgr/nodes/%s/reboot_required" % socket.gethostname())
mocked_sleep = mocker.patch("time.sleep", side_effect=remove_reboot_required)
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
result = run_cli(rebootmgr, ["-v", "--check-triggers"])
mocked_sleep.assert_any_call(130)
mocked_run.assert_not_called()
assert "No reboot necessary" in result.output
assert result.exit_code == 0
def test_reboot_required_because_file(
run_cli, forward_consul_port, default_config, reboot_task,
mock_subprocess_run, mocker):
mocked_sleep = mocker.patch("time.sleep")
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
mocker.patch("os.path.isfile", new=lambda f: f == "/var/run/reboot-required")
result = run_cli(rebootmgr, ["-v", "--check-triggers"])
mocked_sleep.assert_any_call(130)
mocked_run.assert_any_call(["shutdown", "-r", "+1"], check=True)
assert "Reboot now ..." in result.output
assert result.exit_code == 0
def test_reboot_required_because_file_but_removed_after_sleep(
run_cli, forward_consul_port, default_config, reboot_task,
mock_subprocess_run, mocker):
reboot_required_file_is_present = True
def remove_file(seconds):
nonlocal reboot_required_file_is_present
if seconds == 130:
reboot_required_file_is_present = False
def new_isfile(f):
return reboot_required_file_is_present and \
f == "/var/run/reboot-required"
mocked_sleep = mocker.patch("time.sleep", side_effect=remove_file)
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
mocker.patch("os.path.isfile", new=new_isfile)
result = run_cli(rebootmgr, ["-v", "--check-triggers"])
mocked_sleep.assert_any_call(130)
mocked_run.assert_not_called()
assert "No reboot necessary" in result.output
assert result.exit_code == 0
def test_reboot_on_holiday(
run_cli, forward_consul_port, default_config, reboot_task,
mock_subprocess_run, mocker):
mocker.patch("time.sleep")
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
today = datetime.date.today()
tomorrow = today + datetime.timedelta(days=1)
mocker.patch("holidays.DE", new=lambda: [today, tomorrow])
result = run_cli(rebootmgr, ["-v", "--check-holidays"])
mocked_run.assert_not_called()
assert "Refuse to run on holiday" in result.output
assert result.exit_code == 6
def test_reboot_on_not_a_holiday(
run_cli, forward_consul_port, default_config, reboot_task,
mock_subprocess_run, mocker):
mocked_sleep = mocker.patch("time.sleep")
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
mocker.patch("holidays.DE", new=lambda: [])
result = run_cli(rebootmgr, ["-v", "--check-holidays"])
mocked_sleep.assert_any_call(130)
mocked_run.assert_any_call(["shutdown", "-r", "+1"], check=True)
assert "Reboot now ..." in result.output
assert result.exit_code == 0
def test_reboot_when_node_disabled(
run_cli, forward_consul_port, consul_cluster, reboot_task,
mock_subprocess_run, mocker):
consul_cluster[0].kv.put("service/rebootmgr/nodes/{}/config".format(socket.gethostname()), '{"enabled": false}')
mocker.patch("time.sleep")
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
result = run_cli(rebootmgr, ["-v"])
mocked_run.assert_not_called()
assert "Rebootmgr is disabled in consul config for this node" in result.output
assert result.exit_code == 101
def test_reboot_when_node_disabled_but_ignored(
run_cli, forward_consul_port, consul_cluster, reboot_task,
mock_subprocess_run, mocker):
consul_cluster[0].kv.put("service/rebootmgr/nodes/{}/config".format(socket.gethostname()), '{"enabled": false}')
mocked_sleep = mocker.patch("time.sleep")
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
result = run_cli(rebootmgr, ["-v", "--ignore-node-disabled"])
mocked_sleep.assert_any_call(130)
mocked_run.assert_any_call(["shutdown", "-r", "+1"], check=True)
assert "Reboot now ..." in result.output
assert result.exit_code == 0
# TODO(oseibert): Should a MISSING configuration also be ignored with --ignore-node-disabled?
# TODO(oseibert): Fix this bug.
@pytest.mark.xfail
def test_reboot_when_node_disabled_after_sleep(
run_cli, forward_consul_port, consul_cluster, default_config,
reboot_task, mock_subprocess_run, mocker):
def set_configuration_disabled(seconds):
if seconds == 130:
consul_cluster[0].kv.put("service/rebootmgr/nodes/{}/config".format(socket.gethostname()), '{"enabled": false}')
# When rebootmgr sleeps for 2 minutes, the stop flag will be set.
mocked_sleep = mocker.patch("time.sleep", side_effect=set_configuration_disabled)
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
result = run_cli(rebootmgr, ["-v"])
mocked_sleep.assert_any_call(130)
mocked_run.assert_not_called()
assert result.exit_code == 101
def test_reboot_when_global_stop_flag(
run_cli, forward_consul_port, consul_cluster, default_config,
reboot_task, mock_subprocess_run, mocker):
consul_cluster[0].kv.put("service/rebootmgr/stop", "")
mocker.patch("time.sleep")
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
result = run_cli(rebootmgr, ["-v"])
mocked_run.assert_not_called()
assert "Global stop flag is set: exit" in result.output
assert result.exit_code == 102
def test_reboot_when_global_stop_flag_after_sleep(
run_cli, forward_consul_port, consul_cluster, default_config,
reboot_task, mock_subprocess_run, mocker):
def set_stop_flag(seconds):
if seconds == 130:
consul_cluster[0].kv.put("service/rebootmgr/stop", "")
# When rebootmgr sleeps for 2 minutes, the stop flag will be set.
mocked_sleep = mocker.patch("time.sleep", side_effect=set_stop_flag)
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
result = run_cli(rebootmgr, ["-v"])
mocked_sleep.assert_any_call(130)
mocked_run.assert_not_called()
assert "Global stop flag is set: exit" in result.output
assert result.exit_code == 102
def test_reboot_when_global_stop_flag_when_ignored(
run_cli, forward_consul_port, consul_cluster, default_config,
reboot_task, mock_subprocess_run, mocker):
consul_cluster[0].kv.put("service/rebootmgr/stop", "")
mocked_sleep = mocker.patch("time.sleep")
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
result = run_cli(rebootmgr, ["-v", "--ignore-global-stop-flag"])
mocked_sleep.assert_any_call(130)
mocked_run.assert_any_call(["shutdown", "-r", "+1"], check=True)
assert "Reboot now ..." in result.output
assert result.exit_code == 0
def test_reboot_when_global_stop_flag_after_sleep_when_ignored(
run_cli, forward_consul_port, consul_cluster, default_config,
reboot_task, mock_subprocess_run, mocker):
def set_stop_flag(seconds):
if seconds == 130:
consul_cluster[0].kv.put("service/rebootmgr/stop", "")
# When rebootmgr sleeps for 2 minutes, the stop flag will be set.
mocked_sleep = mocker.patch("time.sleep", side_effect=set_stop_flag)
mocked_run = mock_subprocess_run(["shutdown", "-r", "+1"])
result = run_cli(rebootmgr, ["-v", "--ignore-global-stop-flag"])
mocked_sleep.assert_any_call(130)
mocked_run.assert_any_call(["shutdown", "-r", "+1"], check=True)
assert "Reboot now ..." in result.output
assert result.exit_code == 0
| 36.820408
| 124
| 0.703026
| 1,219
| 9,021
| 4.889253
| 0.102543
| 0.028188
| 0.074161
| 0.044631
| 0.906711
| 0.881544
| 0.868624
| 0.84396
| 0.824161
| 0.784396
| 0
| 0.013294
| 0.166168
| 9,021
| 244
| 125
| 36.971311
| 0.779048
| 0.034697
| 0
| 0.748503
| 0
| 0
| 0.15054
| 0.049759
| 0
| 0
| 0
| 0.004098
| 0.299401
| 1
| 0.11976
| false
| 0
| 0.023952
| 0.005988
| 0.149701
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
e538ddaf756249b14b6607b838711008c6ff807d
| 16,389
|
py
|
Python
|
lang/python/github/com/metaprov/modelaapi/services/prediction/v1/prediction_pb2_grpc.py
|
metaprov/modeldapi
|
ee05693832051dcd990ee4f061715d7ae0787340
|
[
"Apache-2.0"
] | 5
|
2022-02-18T03:40:10.000Z
|
2022-03-01T16:11:24.000Z
|
lang/python/github/com/metaprov/modelaapi/services/prediction/v1/prediction_pb2_grpc.py
|
metaprov/modeldapi
|
ee05693832051dcd990ee4f061715d7ae0787340
|
[
"Apache-2.0"
] | 1
|
2022-01-07T19:59:25.000Z
|
2022-02-04T01:21:14.000Z
|
lang/python/github/com/metaprov/modelaapi/services/prediction/v1/prediction_pb2_grpc.py
|
metaprov/modeldapi
|
ee05693832051dcd990ee4f061715d7ae0787340
|
[
"Apache-2.0"
] | 1
|
2022-03-25T10:21:43.000Z
|
2022-03-25T10:21:43.000Z
|
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from github.com.metaprov.modelaapi.services.prediction.v1 import prediction_pb2 as github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2
class PredictionServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.ListPredictions = channel.unary_unary(
'/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/ListPredictions',
request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.ListPredictionsRequest.SerializeToString,
response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.ListPredictionsResponse.FromString,
)
self.CreatePrediction = channel.unary_unary(
'/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/CreatePrediction',
request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.CreatePredictionRequest.SerializeToString,
response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.CreatePredictionResponse.FromString,
)
self.GetPrediction = channel.unary_unary(
'/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/GetPrediction',
request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.GetPredictionRequest.SerializeToString,
response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.GetPredictionResponse.FromString,
)
self.UpdatePrediction = channel.unary_unary(
'/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/UpdatePrediction',
request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.UpdatePredictionRequest.SerializeToString,
response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.UpdatePredictionResponse.FromString,
)
self.DeletePrediction = channel.unary_unary(
'/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/DeletePrediction',
request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DeletePredictionRequest.SerializeToString,
response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DeletePredictionResponse.FromString,
)
self.Download = channel.unary_unary(
'/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/Download',
request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DownloadPredictionRequest.SerializeToString,
response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DownloadPredictionResponse.FromString,
)
self.Abort = channel.unary_unary(
'/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/Abort',
request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.AbortPredictionRequest.SerializeToString,
response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.AbortPredictionResponse.FromString,
)
class PredictionServiceServicer(object):
"""Missing associated documentation comment in .proto file."""
def ListPredictions(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def CreatePrediction(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def GetPrediction(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def UpdatePrediction(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def DeletePrediction(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Download(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Abort(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_PredictionServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'ListPredictions': grpc.unary_unary_rpc_method_handler(
servicer.ListPredictions,
request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.ListPredictionsRequest.FromString,
response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.ListPredictionsResponse.SerializeToString,
),
'CreatePrediction': grpc.unary_unary_rpc_method_handler(
servicer.CreatePrediction,
request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.CreatePredictionRequest.FromString,
response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.CreatePredictionResponse.SerializeToString,
),
'GetPrediction': grpc.unary_unary_rpc_method_handler(
servicer.GetPrediction,
request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.GetPredictionRequest.FromString,
response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.GetPredictionResponse.SerializeToString,
),
'UpdatePrediction': grpc.unary_unary_rpc_method_handler(
servicer.UpdatePrediction,
request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.UpdatePredictionRequest.FromString,
response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.UpdatePredictionResponse.SerializeToString,
),
'DeletePrediction': grpc.unary_unary_rpc_method_handler(
servicer.DeletePrediction,
request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DeletePredictionRequest.FromString,
response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DeletePredictionResponse.SerializeToString,
),
'Download': grpc.unary_unary_rpc_method_handler(
servicer.Download,
request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DownloadPredictionRequest.FromString,
response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DownloadPredictionResponse.SerializeToString,
),
'Abort': grpc.unary_unary_rpc_method_handler(
servicer.Abort,
request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.AbortPredictionRequest.FromString,
response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.AbortPredictionResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'github.com.metaprov.modelaapi.services.prediction.v1.PredictionService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class PredictionService(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def ListPredictions(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/ListPredictions',
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.ListPredictionsRequest.SerializeToString,
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.ListPredictionsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def CreatePrediction(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/CreatePrediction',
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.CreatePredictionRequest.SerializeToString,
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.CreatePredictionResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetPrediction(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/GetPrediction',
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.GetPredictionRequest.SerializeToString,
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.GetPredictionResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def UpdatePrediction(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/UpdatePrediction',
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.UpdatePredictionRequest.SerializeToString,
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.UpdatePredictionResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def DeletePrediction(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/DeletePrediction',
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DeletePredictionRequest.SerializeToString,
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DeletePredictionResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def Download(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/Download',
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DownloadPredictionRequest.SerializeToString,
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.DownloadPredictionResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def Abort(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.prediction.v1.PredictionService/Abort',
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.AbortPredictionRequest.SerializeToString,
github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_prediction_dot_v1_dot_prediction__pb2.AbortPredictionResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
| 61.845283
| 182
| 0.748917
| 1,673
| 16,389
| 6.829647
| 0.069337
| 0.097847
| 0.04516
| 0.05645
| 0.904691
| 0.904691
| 0.904691
| 0.877385
| 0.867145
| 0.841589
| 0
| 0.007778
| 0.191958
| 16,389
| 264
| 183
| 62.079545
| 0.855018
| 0.048813
| 0
| 0.504505
| 1
| 0
| 0.107535
| 0.081022
| 0
| 0
| 0
| 0
| 0
| 1
| 0.072072
| false
| 0
| 0.009009
| 0.031532
| 0.126126
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
e55947574844c8550134507453cdc8789a21b882
| 4,819
|
py
|
Python
|
authors/apps/favorites/tests/test_favorites.py
|
deferral/ah-django
|
b80ad485339dbb02b74d9b2093543bf8173d51de
|
[
"BSD-3-Clause"
] | 1
|
2019-04-12T08:34:10.000Z
|
2019-04-12T08:34:10.000Z
|
authors/apps/favorites/tests/test_favorites.py
|
deferral/ah-django
|
b80ad485339dbb02b74d9b2093543bf8173d51de
|
[
"BSD-3-Clause"
] | 18
|
2019-03-26T02:17:38.000Z
|
2019-04-26T08:57:47.000Z
|
authors/apps/favorites/tests/test_favorites.py
|
deferral/ah-django
|
b80ad485339dbb02b74d9b2093543bf8173d51de
|
[
"BSD-3-Clause"
] | 1
|
2019-11-22T11:52:32.000Z
|
2019-11-22T11:52:32.000Z
|
from rest_framework import status
from .base_test import FavoriteTestBase, generate_slug_url
class FavoritesTestCase(FavoriteTestBase):
"""
Test Class containing tests for Favorite Module
"""
def test_favorite_own_article(self):
"""
User should be able to favorite his/her article
"""
expected_message = 'article added to favorites'
self.authorize_user(self.user)
self.client.post(self.new_article_path,
self.article, format='json')
response = self.client.put(
generate_slug_url(self.article_slug))
message = response.data['message']
self.assertEqual(expected_message, message)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
def test_favorite_another_article(self):
"""
User should be able to favorite another user's article
"""
expected_message = 'article added to favorites'
self.authorize_user(self.user)
self.client.post(self.new_article_path,
self.article, format='json')
self.client.credentials()
self.authorize_user(self.second_user)
response = self.client.put(
generate_slug_url(self.article_slug))
message = response.data['message']
self.assertEqual(expected_message, message)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
def test_favorite_article_twice(self):
"""
User should not be able to favorite an article more than once
"""
expected_message = 'article already exists in favorites'
self.authorize_user(self.user)
self.client.post(self.new_article_path,
self.article, format='json')
self.client.put(generate_slug_url(self.article_slug))
response = self.client.put(generate_slug_url(self.article_slug))
message = response.data['error']
self.assertEqual(expected_message, message)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_favorite_non_existent_article(self):
"""
User should not be able to favorite an article
that does not exist
"""
expected_message = 'article with given slug not found'
self.authorize_user(self.user)
self.client.post(self.new_article_path,
self.article, format='json')
response = self.client.put(
generate_slug_url(self.non_existent_article_slug))
message = response.data['error']
self.assertEqual(expected_message, message)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
def test_remove_article_from_favorites(self):
"""
User should be able to remove an article from favorites
"""
expected_message = 'article removed from favorites'
self.authorize_user(self.user)
self.client.post(self.new_article_path,
self.article, format='json')
self.client.put(
generate_slug_url(self.article_slug))
response = self.client.delete(
generate_slug_url(self.article_slug))
message = response.data['message']
self.assertEqual(expected_message, message)
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_remove_article_from_favorites_twice(self):
"""
User should not be able to remove an article
from favorites more than once
"""
expected_message = 'article not in favorites'
self.authorize_user(self.user)
self.client.post(self.new_article_path,
self.article, format='json')
self.client.put(
generate_slug_url(self.article_slug))
self.client.delete(
generate_slug_url(self.article_slug))
response = self.client.delete(
generate_slug_url(self.article_slug))
message = response.data['message']
self.assertEqual(expected_message, message)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
def test_remove_non_existent_article_favorites(self):
"""
User should not be able to delete a favorite
article that does not exist
"""
expected_message = 'article with given slug not found'
self.authorize_user(self.user)
self.client.post(self.new_article_path,
self.article, format='json')
response = self.client.delete(
generate_slug_url(self.non_existent_article_slug))
message = response.data['error']
self.assertEqual(expected_message, message)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
| 36.78626
| 75
| 0.653248
| 561
| 4,819
| 5.379679
| 0.142603
| 0.062956
| 0.059642
| 0.069251
| 0.870444
| 0.870444
| 0.825712
| 0.817429
| 0.758118
| 0.752816
| 0
| 0.005909
| 0.262503
| 4,819
| 130
| 76
| 37.069231
| 0.843275
| 0.100228
| 0
| 0.753086
| 1
| 0
| 0.067231
| 0
| 0
| 0
| 0
| 0
| 0.17284
| 1
| 0.08642
| false
| 0
| 0.024691
| 0
| 0.123457
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
e5b0f2c372fdf8d1b4a5c7d3bc39f579868c7624
| 137
|
py
|
Python
|
src/loralay/modeling/led_hetformer/__init__.py
|
laudao/loralay-modeling
|
a7c89717bac4f0ef9ed820544c4d27e2fe2e4228
|
[
"Apache-2.0"
] | null | null | null |
src/loralay/modeling/led_hetformer/__init__.py
|
laudao/loralay-modeling
|
a7c89717bac4f0ef9ed820544c4d27e2fe2e4228
|
[
"Apache-2.0"
] | null | null | null |
src/loralay/modeling/led_hetformer/__init__.py
|
laudao/loralay-modeling
|
a7c89717bac4f0ef9ed820544c4d27e2fe2e4228
|
[
"Apache-2.0"
] | null | null | null |
from .modeling_led_hetformer import LEDHeterformerForConditionalGeneration
from .configuration_led_hetformer import LEDHeterformerConfig
| 68.5
| 75
| 0.927007
| 12
| 137
| 10.25
| 0.666667
| 0.195122
| 0.292683
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.058394
| 137
| 2
| 76
| 68.5
| 0.953488
| 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
| 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
| 7
|
e5ca31afa0b3a7223a177bbc5c79b36c407bf8e6
| 79
|
py
|
Python
|
src/generator/utils.py
|
altostratous/ancc
|
583bb1fd0aa6f0ef649b89909b623ae291ebc6f6
|
[
"MIT"
] | null | null | null |
src/generator/utils.py
|
altostratous/ancc
|
583bb1fd0aa6f0ef649b89909b623ae291ebc6f6
|
[
"MIT"
] | null | null | null |
src/generator/utils.py
|
altostratous/ancc
|
583bb1fd0aa6f0ef649b89909b623ae291ebc6f6
|
[
"MIT"
] | null | null | null |
def indval(x):
return '@' + str(x)
def immval(x):
return '#' + str(x)
| 13.166667
| 23
| 0.506329
| 12
| 79
| 3.333333
| 0.5
| 0.35
| 0.5
| 0.55
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.265823
| 79
| 6
| 24
| 13.166667
| 0.689655
| 0
| 0
| 0
| 0
| 0
| 0.025
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 8
|
e5df56c53e98dfbcd92cde7e56e330f0e0a22616
| 355
|
py
|
Python
|
tests/internal/instance_type/test_instance_type_r5a_auto.py
|
frolovv/aws.ec2.compare
|
582805823492f833d65c0441c4a14dce697c12aa
|
[
"Apache-2.0"
] | null | null | null |
tests/internal/instance_type/test_instance_type_r5a_auto.py
|
frolovv/aws.ec2.compare
|
582805823492f833d65c0441c4a14dce697c12aa
|
[
"Apache-2.0"
] | null | null | null |
tests/internal/instance_type/test_instance_type_r5a_auto.py
|
frolovv/aws.ec2.compare
|
582805823492f833d65c0441c4a14dce697c12aa
|
[
"Apache-2.0"
] | 1
|
2021-12-15T11:58:22.000Z
|
2021-12-15T11:58:22.000Z
|
# Testing module instance_type.r5a
import pytest
import ec2_compare.internal.instance_type.r5a
def test_get_internal_data_instance_type_r5a_get_instances_list():
assert len(ec2_compare.internal.instance_type.r5a.get_instances_list()) > 0
def test_get_internal_data_instance_type_r5a_get():
assert len(ec2_compare.internal.instance_type.r5a.get) > 0
| 35.5
| 77
| 0.850704
| 56
| 355
| 4.946429
| 0.339286
| 0.259928
| 0.32491
| 0.259928
| 0.826715
| 0.826715
| 0.613718
| 0.613718
| 0.613718
| 0
| 0
| 0.033435
| 0.073239
| 355
| 9
| 78
| 39.444444
| 0.808511
| 0.090141
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0.333333
| true
| 0
| 0.333333
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 10
|
e5e1ccdf8c4a82c52966d10e46ad0354723fcbb9
| 24,146
|
py
|
Python
|
tests/test_compute_response.py
|
jborean93/ntlm_auth
|
417db8b6fb0f9b5f86f314e257b8a4893f74c057
|
[
"MIT"
] | 46
|
2016-12-23T03:35:14.000Z
|
2022-02-18T20:48:25.000Z
|
tests/test_compute_response.py
|
jborean93/ntlm_auth
|
417db8b6fb0f9b5f86f314e257b8a4893f74c057
|
[
"MIT"
] | 29
|
2016-08-28T22:58:13.000Z
|
2021-05-05T19:20:32.000Z
|
tests/test_compute_response.py
|
jborean93/ntlm_auth
|
417db8b6fb0f9b5f86f314e257b8a4893f74c057
|
[
"MIT"
] | 21
|
2016-12-20T14:23:08.000Z
|
2020-10-02T19:06:56.000Z
|
import struct
import time
from ntlm_auth.compute_response import ComputeResponse, get_windows_timestamp
from ntlm_auth.constants import AvId, AvFlags
from ntlm_auth.messages import ChallengeMessage, TargetInfo
class TestGeneric(object):
def test_get_timestamp_format(self):
actual1 = struct.unpack("<q", get_windows_timestamp())[0]
time.sleep(1)
actual2 = struct.unpack("<q", get_windows_timestamp())[0]
assert actual2 > actual1
class TestHashResults(object):
def test_get_LMv1_response(self):
# 4.2.2.2.2 - LMv1 Response
server_challenge = b"\x01\x23\x45\x67\x89\xab\xcd\xef"
expected = b"\x98\xde\xf7\xb8\x7f\x88\xaa\x5d" \
b"\xaf\xe2\xdf\x77\x96\x88\xa1\x72" \
b"\xde\xf1\x1c\x7d\x5c\xcd\xef\x13"
actual = ComputeResponse._get_LMv1_response("Password",
server_challenge)
assert actual == expected
def test_get_LMv2_response(self):
# 4.2.4.2.1 - LMv2 Response
server_challenge = b"\x01\x23\x45\x67\x89\xab\xcd\xef"
client_challenge = b"\xaa" * 8
expected = b"\x86\xc3\x50\x97\xac\x9c\xec\x10" \
b"\x25\x54\x76\x4a\x57\xcc\xcc\x19" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
actual = ComputeResponse._get_LMv2_response("User", "Password",
"Domain", server_challenge,
client_challenge)
assert actual == expected
def test_get_NTLMv1_response(self):
# 4.2.2.2.1 - NTLMv1 Response
server_challenge = b"\x01\x23\x45\x67\x89\xab\xcd\xef"
expected_response = b"\x67\xc4\x30\x11\xf3\x02\x98\xa2" \
b"\xad\x35\xec\xe6\x4f\x16\x33\x1c" \
b"\x44\xbd\xbe\xd9\x27\x84\x1f\x94"
expected_key = b"\xd8\x72\x62\xb0\xcd\xe4\xb1\xcb" \
b"\x74\x99\xbe\xcc\xcd\xf1\x07\x84"
actual_response, actual_key = \
ComputeResponse._get_NTLMv1_response("Password", server_challenge)
assert actual_response == expected_response
assert actual_key == expected_key
def test_get_NTLM2_response(self):
# 4.2.3.2.2 - NTLMv1 Response
server_challenge = b"\x01\x23\x45\x67\x89\xab\xcd\xef"
client_challenge = b"\xaa" * 8
expected_response = b"\x75\x37\xf8\x03\xae\x36\x71\x28" \
b"\xca\x45\x82\x04\xbd\xe7\xca\xf8" \
b"\x1e\x97\xed\x26\x83\x26\x72\x32"
expected_key = b"\xd8\x72\x62\xb0\xcd\xe4\xb1\xcb" \
b"\x74\x99\xbe\xcc\xcd\xf1\x07\x84"
actual_response, actual_key = \
ComputeResponse._get_NTLM2_response("Password", server_challenge,
client_challenge)
assert actual_response == expected_response
assert actual_key == expected_key
def test_nt_v2_temp_response(self):
# 4.2.4.1.3 - temp
test_target_info = TargetInfo()
test_target_info[AvId.MSV_AV_NB_DOMAIN_NAME] = \
b"\x44\x00\x6f\x00\x6d\x00\x61\x00\x69\x00\x6e\x00"
test_target_info[AvId.MSV_AV_NB_COMPUTER_NAME] = \
b"\x53\x00\x65\x00\x72\x00\x76\x00\x65\x00\x72\x00"
expected = b"\x01\x01\x00\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00\x00\x00\x00\x00" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" \
b"\x00\x00\x00\x00\x02\x00\x0c\x00" \
b"\x44\x00\x6f\x00\x6d\x00\x61\x00" \
b"\x69\x00\x6e\x00\x01\x00\x0c\x00" \
b"\x53\x00\x65\x00\x72\x00\x76\x00" \
b"\x65\x00\x72\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00"
actual = ComputeResponse._get_NTLMv2_temp(b"\x00" * 8, b"\xaa" * 8,
test_target_info)
assert actual == expected
def test_get_NTLMv2_response(self):
# 4.2.4.2.2 - NTLMv2 Response
server_challenge = b"\x01\x23\x45\x67\x89\xab\xcd\xef"
client_challenge = b"\xaa" * 8
test_target_info = TargetInfo()
test_target_info[AvId.MSV_AV_NB_DOMAIN_NAME] = \
b"\x44\x00\x6f\x00\x6d\x00\x61\x00\x69\x00\x6e\x00"
test_target_info[AvId.MSV_AV_NB_COMPUTER_NAME] = \
b"\x53\x00\x65\x00\x72\x00\x76\x00\x65\x00\x72\x00"
expected_response = b"\x68\xcd\x0a\xb8\x51\xe5\x1c\x96" \
b"\xaa\xbc\x92\x7b\xeb\xef\x6a\x1c" \
b"\x01\x01\x00\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00\x00\x00\x00\x00" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" \
b"\x00\x00\x00\x00\x02\x00\x0c\x00" \
b"\x44\x00\x6f\x00\x6d\x00\x61\x00" \
b"\x69\x00\x6e\x00\x01\x00\x0c\x00" \
b"\x53\x00\x65\x00\x72\x00\x76\x00" \
b"\x65\x00\x72\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00"
expected_key = b"\x8d\xe4\x0c\xca\xdb\xc1\x4a\x82" \
b"\xf1\x5c\xb0\xad\x0d\xe9\x5c\xa3"
actual_response, actual_key = \
ComputeResponse._get_NTLMv2_response("User", "Password", "Domain",
server_challenge,
client_challenge, b"\x00" * 8,
test_target_info)
assert actual_response == expected_response
assert actual_key == expected_key
class TestChallengeResults(object):
def test_lm_v1_response(self):
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x0c\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x02\xe2"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00"
)
expected = b"\x98\xde\xf7\xb8\x7f\x88\xaa\x5d" \
b"\xaf\xe2\xdf\x77\x96\x88\xa1\x72" \
b"\xde\xf1\x1c\x7d\x5c\xcd\xef\x13"
actual = ComputeResponse("User", "Password", "Domain",
test_challenge_message,
1).get_lm_challenge_response()
assert actual == expected
def test_lm_v1_with_extended_security_response(self, monkeypatch):
monkeypatch.setattr('os.urandom', lambda s: b"\xaa" * 8)
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x0c\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x0a\x82"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00"
)
expected = b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" \
b"\x00\x00\x00\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00\x00\x00\x00\x00"
actual = ComputeResponse("User", "Password", "Domain",
test_challenge_message,
1).get_lm_challenge_response()
assert actual == expected
def test_lm_v1_with_ntlm_2_response(self):
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x0c\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x02\xe2"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00"
)
# Not explicitly in the example shown but it does expect the same
# response that we already have set
expected = b"\x67\xc4\x30\x11\xf3\x02\x98\xa2" \
b"\xad\x35\xec\xe6\x4f\x16\x33\x1c" \
b"\x44\xbd\xbe\xd9\x27\x84\x1f\x94"
actual = ComputeResponse("User", "Password", "Domain",
test_challenge_message,
2).get_lm_challenge_response()
assert actual == expected
def test_lm_v2_response(self, monkeypatch):
monkeypatch.setattr('os.urandom', lambda s: b"\xaa" * 8)
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x03\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x8a\xe2"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x24\x00\x24\x00\x44\x00\x00\x00"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x02\x00\x0c\x00"
b"\x44\x00\x6f\x00\x6d\x00\x61\x00"
b"\x69\x00\x6e\x00\x01\x00\x0c\x00"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x00\x00\x00\x00"
)
expected = b"\x86\xc3\x50\x97\xac\x9c\xec\x10" \
b"\x25\x54\x76\x4a\x57\xcc\xcc\x19" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
actual = ComputeResponse("User", "Password", "Domain",
test_challenge_message,
3).get_lm_challenge_response()
assert actual == expected
def test_lm_v2_response_with_no_target_info_timestamp(self, monkeypatch):
monkeypatch.setattr('os.urandom', lambda s: b"\xaa" * 8)
test_target_info = TargetInfo()
test_target_info[AvId.MSV_AV_NB_DOMAIN_NAME] = \
b"\x44\x00\x6f\x00\x6d\x00\x61\x00\x69\x00\x6e\x00"
test_target_info[AvId.MSV_AV_NB_COMPUTER_NAME] = \
b"\x53\x00\x65\x00\x72\x00\x76\x00\x65\x00\x72\x00"
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x03\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x8a\xe2"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x24\x00\x24\x00\x44\x00\x00\x00"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x02\x00\x0c\x00"
b"\x44\x00\x6f\x00\x6d\x00\x61\x00"
b"\x69\x00\x6e\x00\x01\x00\x0c\x00"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x00\x00\x00\x00"
)
test_challenge_message.target_info = test_target_info
expected = b"\x86\xc3\x50\x97\xac\x9c\xec\x10" \
b"\x25\x54\x76\x4a\x57\xcc\xcc\x19" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
actual = ComputeResponse("User", "Password", "Domain",
test_challenge_message,
3).get_lm_challenge_response()
assert actual == expected
def test_lm_v2_response_with_server_target_info_timestamp(self):
test_target_info = TargetInfo()
test_target_info[AvId.MSV_AV_NB_DOMAIN_NAME] = \
b"\x44\x00\x6f\x00\x6d\x00\x61\x00\x69\x00\x6e\x00"
test_target_info[AvId.MSV_AV_NB_COMPUTER_NAME] = \
b"\x53\x00\x65\x00\x72\x00\x76\x00\x65\x00\x72\x00"
test_target_info[AvId.MSV_AV_TIMESTAMP] = b"\x00" * 8
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x03\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x8a\xe2"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x24\x00\x24\x00\x44\x00\x00\x00"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x02\x00\x0c\x00"
b"\x44\x00\x6f\x00\x6d\x00\x61\x00"
b"\x69\x00\x6e\x00\x01\x00\x0c\x00"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x00\x00\x00\x00"
)
test_challenge_message.target_info = test_target_info
# Not in MS-NLMP, using expected value
expected = b"\x00" * 24
actual = ComputeResponse("User", "Password", "Domain",
test_challenge_message,
3).get_lm_challenge_response()
assert actual == expected
def test_nt_v1_response(self):
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x0c\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x02\xe2"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00"
)
test_lmv1_response = b"\x98\xde\xf7\xb8\x7f\x88\xaa\x5d" \
b"\xaf\xe2\xdf\x77\x96\x88\xa1\x72" \
b"\xde\xf1\x1c\x7d\x5c\xcd\xef\x13"
expected_response = b"\x67\xc4\x30\x11\xf3\x02\x98\xa2" \
b"\xad\x35\xec\xe6\x4f\x16\x33\x1c" \
b"\x44\xbd\xbe\xd9\x27\x84\x1f\x94"
expected_exchange_key = b"\xd8\x72\x62\xb0\xcd\xe4\xb1\xcb" \
b"\x74\x99\xbe\xcc\xcd\xf1\x07\x84"
expected_target_info = None
comp_response = ComputeResponse("User", "Password", "Domain",
test_challenge_message, 1)
actual_response, actual_exchange_key, actual_target_info = \
comp_response.get_nt_challenge_response(test_lmv1_response, None)
assert actual_response == expected_response
assert actual_exchange_key == expected_exchange_key
assert actual_target_info == expected_target_info
def test_nt_v1_with_extended_security_response(self, monkeypatch):
monkeypatch.setattr('os.urandom', lambda s: b"\xaa" * 8)
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x0c\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x0a\x82"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00"
)
test_lmv1_response = b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" \
b"\x00\x00\x00\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00\x00\x00\x00\x00"
expected_response = b"\x75\x37\xf8\x03\xae\x36\x71\x28" \
b"\xca\x45\x82\x04\xbd\xe7\xca\xf8" \
b"\x1e\x97\xed\x26\x83\x26\x72\x32"
expected_exchange_key = b"\xeb\x93\x42\x9a\x8b\xd9\x52\xf8" \
b"\xb8\x9c\x55\xb8\x7f\x47\x5e\xdc"
expected_target_info = None
comp_response = ComputeResponse("User", "Password", "Domain",
test_challenge_message, 1)
actual_response, actual_exchange_key, actual_target_info = \
comp_response.get_nt_challenge_response(test_lmv1_response, None)
assert actual_response == expected_response
assert actual_exchange_key == expected_exchange_key
assert actual_target_info == expected_target_info
def test_nt_v2_response(self, monkeypatch):
monkeypatch.setattr('os.urandom', lambda s: b"\xaa" * 8)
monkeypatch.setattr('ntlm_auth.compute_response.get_windows_timestamp',
lambda: b"\x00" * 8)
test_target_info = TargetInfo()
test_target_info[AvId.MSV_AV_NB_DOMAIN_NAME] = \
b"\x44\x00\x6f\x00\x6d\x00\x61\x00\x69\x00\x6e\x00"
test_target_info[AvId.MSV_AV_NB_COMPUTER_NAME] = \
b"\x53\x00\x65\x00\x72\x00\x76\x00\x65\x00\x72\x00"
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x03\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x8a\xe2"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x24\x00\x24\x00\x44\x00\x00\x00"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x02\x00\x0c\x00"
b"\x44\x00\x6f\x00\x6d\x00\x61\x00"
b"\x69\x00\x6e\x00\x01\x00\x0c\x00"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x00\x00\x00\x00"
)
test_challenge_message.target_info = test_target_info
test_lmv2_response = b"\x86\xc3\x50\x97\xac\x9c\xec\x10" \
b"\x25\x54\x76\x4a\x57\xcc\xcc\x19" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
expected_response = b"\x68\xcd\x0a\xb8\x51\xe5\x1c\x96" \
b"\xaa\xbc\x92\x7b\xeb\xef\x6a\x1c" \
b"\x01\x01\x00\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00\x00\x00\x00\x00" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" \
b"\x00\x00\x00\x00\x02\x00\x0c\x00" \
b"\x44\x00\x6f\x00\x6d\x00\x61\x00" \
b"\x69\x00\x6e\x00\x01\x00\x0c\x00" \
b"\x53\x00\x65\x00\x72\x00\x76\x00" \
b"\x65\x00\x72\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00"
expected_exchange_key = b"\x8d\xe4\x0c\xca\xdb\xc1\x4a\x82" \
b"\xf1\x5c\xb0\xad\x0d\xe9\x5c\xa3"
expected_target_info = test_target_info
comp_response = ComputeResponse("User", "Password", "Domain",
test_challenge_message, 3)
actual_response, actual_exchange_key, actual_target_info = \
comp_response.get_nt_challenge_response(test_lmv2_response, None)
assert actual_response == expected_response
assert actual_exchange_key == expected_exchange_key
assert actual_target_info == expected_target_info
# The following tests are different from the Microsoft examples, they don't
# give an example of these scenarios so I have made them up
def test_nt_v2_response_no_target_info(self, monkeypatch):
monkeypatch.setattr('os.urandom', lambda s: b"\xaa" * 8)
monkeypatch.setattr('ntlm_auth.compute_response.get_windows_timestamp',
lambda: b"\x00" * 8)
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x03\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x8a\xe2"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x24\x00\x24\x00\x44\x00\x00\x00"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x02\x00\x0c\x00"
b"\x44\x00\x6f\x00\x6d\x00\x61\x00"
b"\x69\x00\x6e\x00\x01\x00\x0c\x00"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x00\x00\x00\x00"
)
test_challenge_message.target_info = None
test_lmv2_response = b"\x86\xc3\x50\x97\xac\x9c\xec\x10" \
b"\x25\x54\x76\x4a\x57\xcc\xcc\x19" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
expected_response = b"\x39\x56\xf2\xe5\x69\xd9\xaf\xa3" \
b"\xac\x2d\x4f\x36\x7d\x38\xb9\xc5" \
b"\x01\x01\x00\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00\x00\x00\x00\x00" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" \
b"\x00\x00\x00\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00"
expected_exchange_key = b"\xe3\x35\x1f\x5b\xe0\xa0\x2b\xc2" \
b"\xee\xb8\x76\x52\xf7\xe0\x77\x75"
expected_target_info = TargetInfo()
comp_response = ComputeResponse("User", "Password", "Domain",
test_challenge_message, 3)
actual_response, actual_exchange_key, actual_target_info = \
comp_response.get_nt_challenge_response(test_lmv2_response, None)
assert actual_response == expected_response
assert actual_exchange_key == expected_exchange_key
assert actual_target_info.pack() == expected_target_info.pack()
def test_nt_v2_response_with_timestamp_av_pair(self, monkeypatch):
monkeypatch.setattr('os.urandom', lambda s: b"\xaa" * 8)
test_target_info = TargetInfo()
test_target_info[AvId.MSV_AV_NB_DOMAIN_NAME] = \
b"\x44\x00\x6f\x00\x6d\x00\x61\x00\x69\x00\x6e\x00"
test_target_info[AvId.MSV_AV_NB_COMPUTER_NAME] = \
b"\x53\x00\x65\x00\x72\x00\x76\x00\x65\x00\x72\x00"
test_target_info[AvId.MSV_AV_TIMESTAMP] = b"\x00" * 8
test_challenge_message = ChallengeMessage(
b"\x4e\x54\x4c\x4d\x53\x53\x50\x00"
b"\x02\x00\x00\x00\x03\x00\x0c\x00"
b"\x38\x00\x00\x00\x33\x82\x8a\xe2"
b"\x01\x23\x45\x67\x89\xab\xcd\xef"
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x24\x00\x24\x00\x44\x00\x00\x00"
b"\x06\x00\x70\x17\x00\x00\x00\x0f"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x02\x00\x0c\x00"
b"\x44\x00\x6f\x00\x6d\x00\x61\x00"
b"\x69\x00\x6e\x00\x01\x00\x0c\x00"
b"\x53\x00\x65\x00\x72\x00\x76\x00"
b"\x65\x00\x72\x00\x00\x00\x00\x00"
)
test_challenge_message.target_info = test_target_info
test_lmv2_response = b"\x86\xc3\x50\x97\xac\x9c\xec\x10" \
b"\x25\x54\x76\x4a\x57\xcc\xcc\x19" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
expected_response = b"\x5d\xeb\xf3\x87\x1c\x28\x94\xb8" \
b"\x1f\x16\x42\x81\xed\xbf\x0b\xff" \
b"\x01\x01\x00\x00\x00\x00\x00\x00" \
b"\x00\x00\x00\x00\x00\x00\x00\x00" \
b"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" \
b"\x00\x00\x00\x00\x02\x00\x0c\x00" \
b"\x44\x00\x6f\x00\x6d\x00\x61\x00" \
b"\x69\x00\x6e\x00\x01\x00\x0c\x00" \
b"\x53\x00\x65\x00\x72\x00\x76\x00" \
b"\x65\x00\x72\x00\x07\x00\x08\x00" \
b"\x00\x00\x00\x00\x00\x00\x00\x00" \
b"\x06\x00\x04\x00\x02\x00\x00\x00" \
b"\x00\x00\x00\x00\x00\x00\x00\x00"
expected_exchange_key = b"\x9b\x37\x06\x8f\x99\x7a\x06\x5f" \
b"\xe9\xc7\x20\x63\x32\x88\xd4\x8f"
expected_target_info = test_target_info
expected_target_info[AvId.MSV_AV_FLAGS] = \
struct.pack("<L", AvFlags.MIC_PROVIDED)
comp_response = ComputeResponse("User", "Password", "Domain",
test_challenge_message, 3)
actual_response, actual_exchange_key, actual_target_info = \
comp_response.get_nt_challenge_response(test_lmv2_response, None)
assert actual_response == expected_response
assert actual_exchange_key == expected_exchange_key
assert actual_target_info == expected_target_info
| 47.813861
| 79
| 0.550526
| 3,444
| 24,146
| 3.716899
| 0.082753
| 0.14952
| 0.165221
| 0.141551
| 0.906726
| 0.901101
| 0.875244
| 0.864698
| 0.850402
| 0.850402
| 0
| 0.197077
| 0.308623
| 24,146
| 504
| 80
| 47.90873
| 0.569726
| 0.017353
| 0
| 0.819861
| 0
| 0.027714
| 0.359182
| 0.33599
| 0
| 0
| 0
| 0
| 0.071594
| 1
| 0.04157
| false
| 0.036952
| 0.011547
| 0
| 0.060046
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
f92d5aa972d7c967f4f62f458c51a7d1eaf220fb
| 206
|
py
|
Python
|
app/views/alekseyl/__init__.py
|
iu5team/rms
|
179bba96fd72eacb89e01f8d75d9ab6a4e4a875a
|
[
"MIT"
] | null | null | null |
app/views/alekseyl/__init__.py
|
iu5team/rms
|
179bba96fd72eacb89e01f8d75d9ab6a4e4a875a
|
[
"MIT"
] | 38
|
2016-04-06T10:29:45.000Z
|
2016-05-18T19:50:20.000Z
|
app/views/alekseyl/__init__.py
|
iu5team/rms
|
179bba96fd72eacb89e01f8d75d9ab6a4e4a875a
|
[
"MIT"
] | null | null | null |
from app.views.alekseyl.active_record import employee
from app.views.alekseyl.active_record import task
from app.views.alekseyl.domain_model import employee
from app.views.alekseyl.domain_model import task
| 41.2
| 53
| 0.864078
| 32
| 206
| 5.4375
| 0.34375
| 0.16092
| 0.275862
| 0.45977
| 0.954023
| 0.954023
| 0.862069
| 0
| 0
| 0
| 0
| 0
| 0.07767
| 206
| 5
| 54
| 41.2
| 0.915789
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 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
| 9
|
00b708554d2ad26732bfbcc4263af430ce672da6
| 151
|
py
|
Python
|
legoformer/data/__init__.py
|
Sirish07/LegoFormer
|
c2173cd107a8e29ed45b086d3956d240fc394d6c
|
[
"MIT"
] | 25
|
2021-07-04T06:28:59.000Z
|
2022-03-12T22:39:06.000Z
|
legoformer/data/__init__.py
|
Sirish07/LegoFormer
|
c2173cd107a8e29ed45b086d3956d240fc394d6c
|
[
"MIT"
] | 2
|
2021-08-25T09:17:44.000Z
|
2021-09-23T11:41:41.000Z
|
legoformer/data/__init__.py
|
Sirish07/LegoFormer
|
c2173cd107a8e29ed45b086d3956d240fc394d6c
|
[
"MIT"
] | 2
|
2021-07-09T00:37:24.000Z
|
2021-08-31T18:04:28.000Z
|
from legoformer.data.transforms import *
from legoformer.data.dataset import ShapeNetDataset
from legoformer.data.datamodule import ShapeNetDataModule
| 37.75
| 57
| 0.874172
| 17
| 151
| 7.764706
| 0.529412
| 0.318182
| 0.409091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.07947
| 151
| 3
| 58
| 50.333333
| 0.94964
| 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
| 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
| 7
|
dacfb1d13e066d3ce0ac55ecde5783ad53e42de9
| 64,432
|
py
|
Python
|
axi_noc/tb16x4/counts.py
|
vhnatyk/vlsistuff
|
0981097bd19a0c482728dcc5048a3615ac9a9a90
|
[
"MIT"
] | 26
|
2018-03-17T18:14:22.000Z
|
2022-03-14T07:23:13.000Z
|
axi_noc/tb16x4/counts.py
|
psumesh/vlsistuff
|
1fe64b093d0581d99c7d826b74c31b8655fa0b31
|
[
"MIT"
] | 1
|
2019-10-16T10:31:11.000Z
|
2019-10-17T04:14:53.000Z
|
axi_noc/tb16x4/counts.py
|
psumesh/vlsistuff
|
1fe64b093d0581d99c7d826b74c31b8655fa0b31
|
[
"MIT"
] | 7
|
2018-07-16T07:51:25.000Z
|
2022-02-15T14:22:54.000Z
|
import logs
import veri
def monitorStuff(Net):
Val = logs.peek(Net)
if Val!=0:
logs.log_error('PANIC activated on %s %s'%(Net,veri.peek(Net)))
return 1
return 0
def monitorStuffs():
panics=0
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.a_rcount")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.b_rcount")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.c_rcount")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.d_rcount")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.a_ar_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.a_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.a_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.a_ids_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.b_ar_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.b_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.b_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.b_ids_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.c_ar_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.c_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.c_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.c_ids_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.d_ar_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.d_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.d_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger0.axi_rd_4_merger.d_ids_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.panic_acount")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.panic_bcount")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.panic_ccount")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.panic_dcount")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.a_bcount")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.b_bcount")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.c_bcount")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.d_bcount")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.a_aw_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.a_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.a_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.a_b_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.a_win_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.a_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.b_aw_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.b_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.b_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.b_b_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.b_out_fifo.next_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.b_out_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.b_win_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.b_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.c_aw_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.c_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.c_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.c_b_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.c_win_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.c_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.d_aw_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.d_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.d_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.d_b_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.d_win_fifo.count")
counts += monitorStuff("tb.dut.merger0.axi_wr_4_merger.d_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.a_rcount")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.b_rcount")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.c_rcount")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.d_rcount")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.a_ar_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.a_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.a_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.a_ids_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.b_ar_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.b_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.b_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.b_ids_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.c_ar_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.c_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.c_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.c_ids_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.d_ar_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.d_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.d_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger1.axi_rd_4_merger.d_ids_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.panic_acount")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.panic_bcount")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.panic_ccount")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.panic_dcount")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.a_bcount")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.b_bcount")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.c_bcount")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.d_bcount")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.a_aw_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.a_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.a_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.a_b_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.a_win_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.a_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.b_aw_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.b_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.b_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.b_b_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.b_out_fifo.next_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.b_out_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.b_win_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.b_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.c_aw_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.c_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.c_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.c_b_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.c_win_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.c_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.d_aw_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.d_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.d_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.d_b_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.d_win_fifo.count")
counts += monitorStuff("tb.dut.merger1.axi_wr_4_merger.d_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.a_rcount")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.b_rcount")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.c_rcount")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.d_rcount")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.a_ar_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.a_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.a_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.a_ids_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.b_ar_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.b_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.b_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.b_ids_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.c_ar_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.c_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.c_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.c_ids_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.d_ar_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.d_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.d_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger2.axi_rd_4_merger.d_ids_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.panic_acount")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.panic_bcount")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.panic_ccount")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.panic_dcount")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.a_bcount")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.b_bcount")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.c_bcount")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.d_bcount")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.a_aw_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.a_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.a_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.a_b_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.a_win_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.a_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.b_aw_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.b_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.b_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.b_b_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.b_out_fifo.next_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.b_out_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.b_win_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.b_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.c_aw_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.c_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.c_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.c_b_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.c_win_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.c_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.d_aw_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.d_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.d_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.d_b_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.d_win_fifo.count")
counts += monitorStuff("tb.dut.merger2.axi_wr_4_merger.d_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.a_rcount")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.b_rcount")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.c_rcount")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.d_rcount")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.a_ar_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.a_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.a_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.a_ids_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.b_ar_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.b_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.b_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.b_ids_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.c_ar_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.c_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.c_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.c_ids_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.d_ar_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.d_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.d_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger3.axi_rd_4_merger.d_ids_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.panic_acount")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.panic_bcount")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.panic_ccount")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.panic_dcount")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.a_bcount")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.b_bcount")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.c_bcount")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.d_bcount")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.a_aw_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.a_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.a_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.a_b_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.a_win_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.a_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.b_aw_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.b_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.b_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.b_b_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.b_out_fifo.next_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.b_out_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.b_win_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.b_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.c_aw_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.c_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.c_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.c_b_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.c_win_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.c_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.d_aw_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.d_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.d_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.d_b_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.d_win_fifo.count")
counts += monitorStuff("tb.dut.merger3.axi_wr_4_merger.d_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.a_rcount")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.b_rcount")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.c_rcount")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.d_rcount")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.a_ar_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.a_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.a_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.a_ids_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.b_ar_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.b_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.b_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.b_ids_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.c_ar_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.c_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.c_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.c_ids_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.d_ar_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.d_ar_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.d_ids_fifo.next_count")
counts += monitorStuff("tb.dut.merger4.axi_rd_4_merger.d_ids_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.panic_acount")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.panic_bcount")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.panic_ccount")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.panic_dcount")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.a_bcount")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.b_bcount")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.c_bcount")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.d_bcount")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.a_aw_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.a_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.a_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.a_b_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.a_win_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.a_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.b_aw_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.b_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.b_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.b_b_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.b_out_fifo.next_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.b_out_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.b_win_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.b_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.c_aw_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.c_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.c_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.c_b_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.c_win_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.c_win_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.d_aw_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.d_aw_fifo.int_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.d_b_fifo.next_count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.d_b_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.d_win_fifo.count")
counts += monitorStuff("tb.dut.merger4.axi_wr_4_merger.d_win_fifo.int_count")
counts += monitorStuff("tb.dut.splitter0.axi_rd_4_splitter.ar_fifo.next_count")
counts += monitorStuff("tb.dut.splitter0.axi_rd_4_splitter.ar_fifo.count")
counts += monitorStuff("tb.dut.splitter0.axi_rd_4_splitter.r_fifo.next_count")
counts += monitorStuff("tb.dut.splitter0.axi_rd_4_splitter.r_fifo.count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.a_bcount")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.b_bcount")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.c_bcount")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.d_bcount")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.aw_fifo.next_count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.aw_fifo.count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.b_fifo.next_count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.b_fifo.count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.back_bid_a_fifo.count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.back_bid_a_fifo.int_count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.back_bid_b_fifo.count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.back_bid_b_fifo.int_count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.back_bid_c_fifo.count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.back_bid_c_fifo.int_count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.back_bid_d_fifo.count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.back_bid_d_fifo.int_count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.order_fifo.next_count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.order_fifo.count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.w_fifo.next_count")
counts += monitorStuff("tb.dut.splitter0.axi_wr_4_splitter.w_fifo.count")
veri.force('tb.Panics',str(panics))
def snapshot():
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.a_rcount" % logs.peek("tb.dut.merger0.axi_rd_4_merger.a_rcount"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.b_rcount" % logs.peek("tb.dut.merger0.axi_rd_4_merger.b_rcount"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.c_rcount" % logs.peek("tb.dut.merger0.axi_rd_4_merger.c_rcount"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.d_rcount" % logs.peek("tb.dut.merger0.axi_rd_4_merger.d_rcount"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.a_ar_fifo.count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.a_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.a_ar_fifo.int_count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.a_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.a_ids_fifo.next_count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.a_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.a_ids_fifo.count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.a_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.b_ar_fifo.count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.b_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.b_ar_fifo.int_count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.b_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.b_ids_fifo.next_count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.b_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.b_ids_fifo.count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.b_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.c_ar_fifo.count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.c_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.c_ar_fifo.int_count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.c_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.c_ids_fifo.next_count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.c_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.c_ids_fifo.count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.c_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.d_ar_fifo.count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.d_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.d_ar_fifo.int_count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.d_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.d_ids_fifo.next_count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.d_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_rd_4_merger.d_ids_fifo.count" % logs.peek("tb.dut.merger0.axi_rd_4_merger.d_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.panic_acount" % logs.peek("tb.dut.merger0.axi_wr_4_merger.panic_acount"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.panic_bcount" % logs.peek("tb.dut.merger0.axi_wr_4_merger.panic_bcount"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.panic_ccount" % logs.peek("tb.dut.merger0.axi_wr_4_merger.panic_ccount"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.panic_dcount" % logs.peek("tb.dut.merger0.axi_wr_4_merger.panic_dcount"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.a_bcount" % logs.peek("tb.dut.merger0.axi_wr_4_merger.a_bcount"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.b_bcount" % logs.peek("tb.dut.merger0.axi_wr_4_merger.b_bcount"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.c_bcount" % logs.peek("tb.dut.merger0.axi_wr_4_merger.c_bcount"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.d_bcount" % logs.peek("tb.dut.merger0.axi_wr_4_merger.d_bcount"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.a_aw_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.a_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.a_aw_fifo.int_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.a_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.a_b_fifo.next_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.a_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.a_b_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.a_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.a_win_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.a_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.a_win_fifo.int_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.a_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.b_aw_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.b_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.b_aw_fifo.int_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.b_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.b_b_fifo.next_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.b_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.b_b_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.b_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.b_out_fifo.next_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.b_out_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.b_out_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.b_out_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.b_win_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.b_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.b_win_fifo.int_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.b_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.c_aw_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.c_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.c_aw_fifo.int_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.c_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.c_b_fifo.next_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.c_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.c_b_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.c_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.c_win_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.c_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.c_win_fifo.int_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.c_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.d_aw_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.d_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.d_aw_fifo.int_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.d_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.d_b_fifo.next_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.d_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.d_b_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.d_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.d_win_fifo.count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.d_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger0.axi_wr_4_merger.d_win_fifo.int_count" % logs.peek("tb.dut.merger0.axi_wr_4_merger.d_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.a_rcount" % logs.peek("tb.dut.merger1.axi_rd_4_merger.a_rcount"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.b_rcount" % logs.peek("tb.dut.merger1.axi_rd_4_merger.b_rcount"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.c_rcount" % logs.peek("tb.dut.merger1.axi_rd_4_merger.c_rcount"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.d_rcount" % logs.peek("tb.dut.merger1.axi_rd_4_merger.d_rcount"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.a_ar_fifo.count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.a_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.a_ar_fifo.int_count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.a_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.a_ids_fifo.next_count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.a_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.a_ids_fifo.count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.a_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.b_ar_fifo.count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.b_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.b_ar_fifo.int_count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.b_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.b_ids_fifo.next_count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.b_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.b_ids_fifo.count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.b_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.c_ar_fifo.count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.c_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.c_ar_fifo.int_count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.c_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.c_ids_fifo.next_count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.c_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.c_ids_fifo.count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.c_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.d_ar_fifo.count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.d_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.d_ar_fifo.int_count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.d_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.d_ids_fifo.next_count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.d_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_rd_4_merger.d_ids_fifo.count" % logs.peek("tb.dut.merger1.axi_rd_4_merger.d_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.panic_acount" % logs.peek("tb.dut.merger1.axi_wr_4_merger.panic_acount"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.panic_bcount" % logs.peek("tb.dut.merger1.axi_wr_4_merger.panic_bcount"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.panic_ccount" % logs.peek("tb.dut.merger1.axi_wr_4_merger.panic_ccount"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.panic_dcount" % logs.peek("tb.dut.merger1.axi_wr_4_merger.panic_dcount"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.a_bcount" % logs.peek("tb.dut.merger1.axi_wr_4_merger.a_bcount"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.b_bcount" % logs.peek("tb.dut.merger1.axi_wr_4_merger.b_bcount"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.c_bcount" % logs.peek("tb.dut.merger1.axi_wr_4_merger.c_bcount"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.d_bcount" % logs.peek("tb.dut.merger1.axi_wr_4_merger.d_bcount"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.a_aw_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.a_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.a_aw_fifo.int_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.a_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.a_b_fifo.next_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.a_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.a_b_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.a_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.a_win_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.a_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.a_win_fifo.int_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.a_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.b_aw_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.b_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.b_aw_fifo.int_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.b_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.b_b_fifo.next_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.b_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.b_b_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.b_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.b_out_fifo.next_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.b_out_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.b_out_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.b_out_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.b_win_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.b_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.b_win_fifo.int_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.b_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.c_aw_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.c_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.c_aw_fifo.int_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.c_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.c_b_fifo.next_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.c_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.c_b_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.c_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.c_win_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.c_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.c_win_fifo.int_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.c_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.d_aw_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.d_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.d_aw_fifo.int_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.d_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.d_b_fifo.next_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.d_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.d_b_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.d_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.d_win_fifo.count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.d_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger1.axi_wr_4_merger.d_win_fifo.int_count" % logs.peek("tb.dut.merger1.axi_wr_4_merger.d_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.a_rcount" % logs.peek("tb.dut.merger2.axi_rd_4_merger.a_rcount"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.b_rcount" % logs.peek("tb.dut.merger2.axi_rd_4_merger.b_rcount"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.c_rcount" % logs.peek("tb.dut.merger2.axi_rd_4_merger.c_rcount"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.d_rcount" % logs.peek("tb.dut.merger2.axi_rd_4_merger.d_rcount"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.a_ar_fifo.count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.a_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.a_ar_fifo.int_count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.a_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.a_ids_fifo.next_count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.a_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.a_ids_fifo.count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.a_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.b_ar_fifo.count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.b_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.b_ar_fifo.int_count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.b_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.b_ids_fifo.next_count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.b_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.b_ids_fifo.count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.b_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.c_ar_fifo.count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.c_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.c_ar_fifo.int_count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.c_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.c_ids_fifo.next_count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.c_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.c_ids_fifo.count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.c_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.d_ar_fifo.count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.d_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.d_ar_fifo.int_count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.d_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.d_ids_fifo.next_count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.d_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_rd_4_merger.d_ids_fifo.count" % logs.peek("tb.dut.merger2.axi_rd_4_merger.d_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.panic_acount" % logs.peek("tb.dut.merger2.axi_wr_4_merger.panic_acount"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.panic_bcount" % logs.peek("tb.dut.merger2.axi_wr_4_merger.panic_bcount"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.panic_ccount" % logs.peek("tb.dut.merger2.axi_wr_4_merger.panic_ccount"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.panic_dcount" % logs.peek("tb.dut.merger2.axi_wr_4_merger.panic_dcount"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.a_bcount" % logs.peek("tb.dut.merger2.axi_wr_4_merger.a_bcount"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.b_bcount" % logs.peek("tb.dut.merger2.axi_wr_4_merger.b_bcount"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.c_bcount" % logs.peek("tb.dut.merger2.axi_wr_4_merger.c_bcount"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.d_bcount" % logs.peek("tb.dut.merger2.axi_wr_4_merger.d_bcount"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.a_aw_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.a_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.a_aw_fifo.int_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.a_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.a_b_fifo.next_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.a_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.a_b_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.a_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.a_win_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.a_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.a_win_fifo.int_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.a_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.b_aw_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.b_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.b_aw_fifo.int_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.b_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.b_b_fifo.next_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.b_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.b_b_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.b_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.b_out_fifo.next_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.b_out_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.b_out_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.b_out_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.b_win_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.b_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.b_win_fifo.int_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.b_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.c_aw_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.c_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.c_aw_fifo.int_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.c_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.c_b_fifo.next_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.c_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.c_b_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.c_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.c_win_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.c_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.c_win_fifo.int_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.c_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.d_aw_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.d_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.d_aw_fifo.int_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.d_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.d_b_fifo.next_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.d_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.d_b_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.d_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.d_win_fifo.count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.d_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger2.axi_wr_4_merger.d_win_fifo.int_count" % logs.peek("tb.dut.merger2.axi_wr_4_merger.d_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.a_rcount" % logs.peek("tb.dut.merger3.axi_rd_4_merger.a_rcount"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.b_rcount" % logs.peek("tb.dut.merger3.axi_rd_4_merger.b_rcount"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.c_rcount" % logs.peek("tb.dut.merger3.axi_rd_4_merger.c_rcount"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.d_rcount" % logs.peek("tb.dut.merger3.axi_rd_4_merger.d_rcount"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.a_ar_fifo.count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.a_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.a_ar_fifo.int_count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.a_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.a_ids_fifo.next_count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.a_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.a_ids_fifo.count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.a_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.b_ar_fifo.count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.b_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.b_ar_fifo.int_count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.b_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.b_ids_fifo.next_count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.b_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.b_ids_fifo.count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.b_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.c_ar_fifo.count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.c_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.c_ar_fifo.int_count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.c_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.c_ids_fifo.next_count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.c_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.c_ids_fifo.count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.c_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.d_ar_fifo.count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.d_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.d_ar_fifo.int_count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.d_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.d_ids_fifo.next_count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.d_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_rd_4_merger.d_ids_fifo.count" % logs.peek("tb.dut.merger3.axi_rd_4_merger.d_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.panic_acount" % logs.peek("tb.dut.merger3.axi_wr_4_merger.panic_acount"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.panic_bcount" % logs.peek("tb.dut.merger3.axi_wr_4_merger.panic_bcount"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.panic_ccount" % logs.peek("tb.dut.merger3.axi_wr_4_merger.panic_ccount"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.panic_dcount" % logs.peek("tb.dut.merger3.axi_wr_4_merger.panic_dcount"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.a_bcount" % logs.peek("tb.dut.merger3.axi_wr_4_merger.a_bcount"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.b_bcount" % logs.peek("tb.dut.merger3.axi_wr_4_merger.b_bcount"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.c_bcount" % logs.peek("tb.dut.merger3.axi_wr_4_merger.c_bcount"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.d_bcount" % logs.peek("tb.dut.merger3.axi_wr_4_merger.d_bcount"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.a_aw_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.a_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.a_aw_fifo.int_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.a_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.a_b_fifo.next_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.a_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.a_b_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.a_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.a_win_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.a_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.a_win_fifo.int_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.a_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.b_aw_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.b_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.b_aw_fifo.int_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.b_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.b_b_fifo.next_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.b_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.b_b_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.b_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.b_out_fifo.next_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.b_out_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.b_out_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.b_out_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.b_win_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.b_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.b_win_fifo.int_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.b_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.c_aw_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.c_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.c_aw_fifo.int_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.c_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.c_b_fifo.next_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.c_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.c_b_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.c_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.c_win_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.c_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.c_win_fifo.int_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.c_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.d_aw_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.d_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.d_aw_fifo.int_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.d_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.d_b_fifo.next_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.d_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.d_b_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.d_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.d_win_fifo.count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.d_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger3.axi_wr_4_merger.d_win_fifo.int_count" % logs.peek("tb.dut.merger3.axi_wr_4_merger.d_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.a_rcount" % logs.peek("tb.dut.merger4.axi_rd_4_merger.a_rcount"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.b_rcount" % logs.peek("tb.dut.merger4.axi_rd_4_merger.b_rcount"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.c_rcount" % logs.peek("tb.dut.merger4.axi_rd_4_merger.c_rcount"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.d_rcount" % logs.peek("tb.dut.merger4.axi_rd_4_merger.d_rcount"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.a_ar_fifo.count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.a_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.a_ar_fifo.int_count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.a_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.a_ids_fifo.next_count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.a_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.a_ids_fifo.count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.a_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.b_ar_fifo.count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.b_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.b_ar_fifo.int_count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.b_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.b_ids_fifo.next_count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.b_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.b_ids_fifo.count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.b_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.c_ar_fifo.count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.c_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.c_ar_fifo.int_count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.c_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.c_ids_fifo.next_count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.c_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.c_ids_fifo.count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.c_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.d_ar_fifo.count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.d_ar_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.d_ar_fifo.int_count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.d_ar_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.d_ids_fifo.next_count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.d_ids_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_rd_4_merger.d_ids_fifo.count" % logs.peek("tb.dut.merger4.axi_rd_4_merger.d_ids_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.panic_acount" % logs.peek("tb.dut.merger4.axi_wr_4_merger.panic_acount"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.panic_bcount" % logs.peek("tb.dut.merger4.axi_wr_4_merger.panic_bcount"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.panic_ccount" % logs.peek("tb.dut.merger4.axi_wr_4_merger.panic_ccount"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.panic_dcount" % logs.peek("tb.dut.merger4.axi_wr_4_merger.panic_dcount"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.a_bcount" % logs.peek("tb.dut.merger4.axi_wr_4_merger.a_bcount"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.b_bcount" % logs.peek("tb.dut.merger4.axi_wr_4_merger.b_bcount"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.c_bcount" % logs.peek("tb.dut.merger4.axi_wr_4_merger.c_bcount"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.d_bcount" % logs.peek("tb.dut.merger4.axi_wr_4_merger.d_bcount"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.a_aw_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.a_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.a_aw_fifo.int_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.a_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.a_b_fifo.next_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.a_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.a_b_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.a_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.a_win_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.a_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.a_win_fifo.int_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.a_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.b_aw_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.b_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.b_aw_fifo.int_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.b_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.b_b_fifo.next_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.b_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.b_b_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.b_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.b_out_fifo.next_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.b_out_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.b_out_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.b_out_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.b_win_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.b_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.b_win_fifo.int_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.b_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.c_aw_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.c_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.c_aw_fifo.int_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.c_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.c_b_fifo.next_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.c_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.c_b_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.c_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.c_win_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.c_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.c_win_fifo.int_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.c_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.d_aw_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.d_aw_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.d_aw_fifo.int_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.d_aw_fifo.int_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.d_b_fifo.next_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.d_b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.d_b_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.d_b_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.d_win_fifo.count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.d_win_fifo.count"))
logs.log_info("SNP %x tb.dut.merger4.axi_wr_4_merger.d_win_fifo.int_count" % logs.peek("tb.dut.merger4.axi_wr_4_merger.d_win_fifo.int_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_rd_4_splitter.ar_fifo.next_count" % logs.peek("tb.dut.splitter0.axi_rd_4_splitter.ar_fifo.next_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_rd_4_splitter.ar_fifo.count" % logs.peek("tb.dut.splitter0.axi_rd_4_splitter.ar_fifo.count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_rd_4_splitter.r_fifo.next_count" % logs.peek("tb.dut.splitter0.axi_rd_4_splitter.r_fifo.next_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_rd_4_splitter.r_fifo.count" % logs.peek("tb.dut.splitter0.axi_rd_4_splitter.r_fifo.count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.a_bcount" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.a_bcount"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.b_bcount" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.b_bcount"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.c_bcount" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.c_bcount"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.d_bcount" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.d_bcount"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.aw_fifo.next_count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.aw_fifo.next_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.aw_fifo.count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.aw_fifo.count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.b_fifo.next_count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.b_fifo.next_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.b_fifo.count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.b_fifo.count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.back_bid_a_fifo.count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.back_bid_a_fifo.count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.back_bid_a_fifo.int_count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.back_bid_a_fifo.int_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.back_bid_b_fifo.count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.back_bid_b_fifo.count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.back_bid_b_fifo.int_count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.back_bid_b_fifo.int_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.back_bid_c_fifo.count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.back_bid_c_fifo.count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.back_bid_c_fifo.int_count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.back_bid_c_fifo.int_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.back_bid_d_fifo.count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.back_bid_d_fifo.count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.back_bid_d_fifo.int_count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.back_bid_d_fifo.int_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.order_fifo.next_count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.order_fifo.next_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.order_fifo.count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.order_fifo.count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.w_fifo.next_count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.w_fifo.next_count"))
logs.log_info("SNP %x tb.dut.splitter0.axi_wr_4_splitter.w_fifo.count" % logs.peek("tb.dut.splitter0.axi_wr_4_splitter.w_fifo.count"))
| 106.499174
| 165
| 0.773187
| 12,339
| 64,432
| 3.644704
| 0.005187
| 0.098061
| 0.076047
| 0.136085
| 0.996086
| 0.996086
| 0.996086
| 0.996086
| 0.996086
| 0.99602
| 0
| 0.02978
| 0.078594
| 64,432
| 604
| 166
| 106.675497
| 0.727732
| 0
| 0
| 0
| 0
| 0
| 0.681287
| 0.644271
| 0
| 0
| 0
| 0
| 0
| 1
| 0.005
| false
| 0
| 0.003333
| 0
| 0.011667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
dae3fd8a9ab67d65cd280a0da07c6d141901db2d
| 158
|
py
|
Python
|
models/user_models.py
|
htrismicristo/cajero_api
|
160781d4569eac2ccc88647452560e395ef69d0d
|
[
"MIT"
] | null | null | null |
models/user_models.py
|
htrismicristo/cajero_api
|
160781d4569eac2ccc88647452560e395ef69d0d
|
[
"MIT"
] | null | null | null |
models/user_models.py
|
htrismicristo/cajero_api
|
160781d4569eac2ccc88647452560e395ef69d0d
|
[
"MIT"
] | null | null | null |
from pydantic import BaseModel
class UserIn(BaseModel):
username: str
password: str
class UserOut(BaseModel):
username: str
password: str
| 13.166667
| 30
| 0.708861
| 18
| 158
| 6.222222
| 0.555556
| 0.303571
| 0.357143
| 0.5
| 0.553571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.227848
| 158
| 11
| 31
| 14.363636
| 0.918033
| 0
| 0
| 0.571429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.285714
| 0.142857
| 0
| 1
| 0
| 1
| 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
| 1
| 0
| 0
| 1
| 0
|
0
| 7
|
dae53036f10da4b837c5d68205204a21f8380d43
| 425
|
py
|
Python
|
enigmatoolbox/permutation_testing/__init__.py
|
saratheriver/ENIGMA
|
c26483bfeb9e035b7ab5f56998d17155aece584f
|
[
"BSD-3-Clause"
] | 49
|
2020-08-31T15:52:37.000Z
|
2022-01-25T12:24:56.000Z
|
enigmatoolbox/permutation_testing/__init__.py
|
saratheriver/ENIGMA
|
c26483bfeb9e035b7ab5f56998d17155aece584f
|
[
"BSD-3-Clause"
] | 7
|
2020-10-23T09:54:31.000Z
|
2022-03-26T03:50:56.000Z
|
enigmatoolbox/permutation_testing/__init__.py
|
MICA-MNI/ENIGMA
|
db879bb21f680bb39c2aa4bd34a9f44d1b1090cd
|
[
"BSD-3-Clause"
] | 9
|
2020-09-21T11:57:06.000Z
|
2022-03-08T18:09:58.000Z
|
from .permutation_testing import (spin_test, shuf_test, centroid_extraction_sphere,
rotate_parcellation, perm_sphere_p, get_subcortical_distance,
MoranRandomization)
__all__ = ['spin_test', 'shuf_test',
'centroid_extraction_sphere',
'rotate_parcellation', 'perm_sphere_p',
'get_subcortical_distance', 'MoranRandomization']
| 47.222222
| 95
| 0.64
| 37
| 425
| 6.72973
| 0.513514
| 0.064257
| 0.096386
| 0.128514
| 0.875502
| 0.875502
| 0.875502
| 0.875502
| 0.875502
| 0.875502
| 0
| 0
| 0.284706
| 425
| 8
| 96
| 53.125
| 0.819079
| 0
| 0
| 0
| 0
| 0
| 0.277647
| 0.117647
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.142857
| 0
| 0.142857
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 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
| 0
|
0
| 7
|
dae54b3691cd10a8e2b3b4665e747d2bebb53269
| 203
|
py
|
Python
|
data/Translation testing 2022-3-16/c2p-helloworld/c++helloworldtranslationwithoutincludes.py
|
LANCHERBA/CodeGen
|
fdb8717658945b81af148787c8303a97a00c615c
|
[
"MIT"
] | null | null | null |
data/Translation testing 2022-3-16/c2p-helloworld/c++helloworldtranslationwithoutincludes.py
|
LANCHERBA/CodeGen
|
fdb8717658945b81af148787c8303a97a00c615c
|
[
"MIT"
] | null | null | null |
data/Translation testing 2022-3-16/c2p-helloworld/c++helloworldtranslationwithoutincludes.py
|
LANCHERBA/CodeGen
|
fdb8717658945b81af148787c8303a97a00c615c
|
[
"MIT"
] | null | null | null |
def test_sympy__physics__quantum__cartesian__PxKet():
from sympy.physics.quantum.cartesian import PxKet
assert _test_args(PxKet(x, y))
# Hello world to a function related to quantum physics...
| 29
| 57
| 0.783251
| 29
| 203
| 5.103448
| 0.655172
| 0.162162
| 0.256757
| 0.378378
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 203
| 6
| 58
| 33.833333
| 0.850575
| 0.270936
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0.333333
| true
| 0
| 0.333333
| 0
| 0.666667
| 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
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
daf3408915818a2ada6ac54bc3405a6200b680b6
| 9,157
|
py
|
Python
|
UNR21-bootcamp/the-cat/decode.py
|
mihaid-b/CyberSakura
|
f60e6b6bfd6898c69b84424b080090ae98f8076c
|
[
"MIT"
] | 1
|
2022-03-27T06:00:41.000Z
|
2022-03-27T06:00:41.000Z
|
UNR21-bootcamp/the-cat/decode.py
|
mihaid-b/CyberSakura
|
f60e6b6bfd6898c69b84424b080090ae98f8076c
|
[
"MIT"
] | null | null | null |
UNR21-bootcamp/the-cat/decode.py
|
mihaid-b/CyberSakura
|
f60e6b6bfd6898c69b84424b080090ae98f8076c
|
[
"MIT"
] | 1
|
2022-03-27T06:01:42.000Z
|
2022-03-27T06:01:42.000Z
|
a = bytes.fromhex("2d2d35386632366631626364653230613734633136396233383465303233333434300d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d227a6970223b2066696c656e616d653d226e79616e2e7a6970220d0a0d0a504b030414000000080052998951643d7ca94e100000520c010007001c006e79616e2e736855540900030b05d15f0b05d15f75780b000104e803000004e8030000ed9d7b57e24816c0ffcfa7c83a9c45c7e30ae8d80f86de751d1d9de9d619df36c3991324c82ba48fe2ac6eafdf7deb95ca83aa4a555242a0eb1e8554487edc7bab12487173ef777fdb7c7cb8df6cf7c79beef82fbbed3cf42cebf866f7b8b15a6e4b8b2778ad6cc9833c114905a44d23a118509a788503e931cdf38aa6517b799d6d40f30089cea02a20e1395d05a44d231d983490939434d02d91602d693ac3a4f0490074cb13c8194545444a0161400ffd21520ac825122070cb190680502711c8e5891331cc71101480381e97043983818335824b7c5097084500e9769dd0456077441aa2050ea83b2df06d9d6e5c23b8cac1cf0a204442a05e080a4400ea1009401d4c0a34eac5386c120075588248c3a0f721c8c3348fe36d1ea8e338a146d8d7e861c0eb360cea130928a8118050a78dc7d4b0f19803eaf3041e2281af0108aa02ff32818631db1c3c0078bd0676b923e211046a402785e78f94de87a03bb644949039b9094160276a095ae0d9454168117c0640ebee481bbf79a80169723805fda40d25c7275cd14d33a06f0be4154e23032a2428ed9c376b10bcb417a316d6b47401205f423cf4d8166c2105f23cf8073802d26c350a40229104a5cbd28102dfb5f3813c3feccf4298e691c776bb281ae9f491a65e8b8a012d2a487406550109cfe92a206d1ae9c01850214123df214b6dba94053472fc01debf4d976440707a2c0922fbd30539109c3d4c82fc01e6a880c03e71d228baaf0208cdd4f0386c124723408a36918b3cb43b7c5200015f44510884fd0c9f5440be1f376de08f8306585402450581064815a8537610b18d682ad16bfde84b77d1c630dc99c9116874c7dcdef7d9879a18141d02e818e31d681190177cafa706b58347c70f97c0a19f02ca2daf04caf1095774d30ce81b02c103b5581a19902650faac882228ed9c276d5a3e109c81c273506df857008d7c8d3ed2d66b72fa88410aae9e9146bebcaba541e9b280473f5ba67d974ba376043557d3e86c1f556bde1a51d1e023cdbd1615039a1dc82b1c48d37748af681af9a93e9afa154d08babd0d76f0493c1c054cc7d57049228d6ec175702c64105c1e7349293e1aa2c711fa0b5a5c90eb5293483c1c69c33d11a087fec4a4b45eeb050ba31186fa9cef13d2d3878e33c2d036dbe5651810474d22f170a44d21f8c919610efb9d381ac566ea02f39cd168c899629198871c4556c391c4e14050a7434d22f170a44dd51925a6fd584ee2988682f4a83ed836327b179f0f4c03213bfc48effbe4b36cc0fbee55860171d424120fe7e3004ab2c9882882c80e7a4d5a231c0c879c13d16a10fc299816f40f19843e0c1544ee81da8c39d3877777d424125447daf0d00a2322311dbe81caec3194bb68d0e0d08f440df24ce3f4039c3f84be259aa025fcc001796d2f3029385392267af3508344535a231f3b3c3c2cd012ef2829dcc791012d10281c8245d1480f28b84a42171285d0482768597b4d0a448d97fd61820d0a43547282320813140e59189d903a0735038d74fa4853af651006288bab5fd9d9195c2dea352da00c326fd0b4c9f3d6480388fec49cb06e094cc3b294bdf6ed80e8a46d3e502468b418a645036b8ba1914e1f69eab5881890012d08883be3a80ae24c13aa813a6adaf041beb265fce9c378b85e668df893bb8a207581a03bf64b8e52b79561c4389b04a33adbe881d56469c4f956ee042183ed48dbe17d895fa463cd800a02625c18668d40989aba9ea769b1c9be62c44468f491a65e634ae14119e632d8a0084611f52aa6b187ec3c350a25bf8f74f75a060941b95cfdcacecee0ea0428bbab17e0e85f349028cc5205e485c3b5201a09c580be25d05488663e8d22a7c0f99ac60aac9dbbb37daa4c4e1fb17a6d3ac62f68df2a900be2a338682ac6ef36111037738da4b67368649cc33eff975118633cc6cf8d06c491bd0724d4cfe7cd45486a8442b41069c009d3e4cc1f25c3951c7a9bb0cf074dc5f875494eb7248836a4358a05d64d719482069df8241b047998e671bc5d46618c41405c34e62f6a1af235f233bc35574123c28d80c6618cdf581114b31482a04d03b4c8014dc5f89176d249a4ad3c20e32329d26fec4936fecce860c0991de5ceb14dc5f8a136ca05e8a38480841b6daa68e4c0df96f0236d874d7990aa18d0d2834417865940cc4bd5399816dea847d59ab346be461f69eb3591141e943de540814dcb3c03f56a1a690615a7d7f2babaf0cece9375aae0a6cd00a42d89a24934a9430c68014045f8eaa71dc4f99c5806d3b02c65af150514ce4be4bb35cfa1f7083a82db17e584eccf8b6ee2cd6831de1557f3e0bd0f07c48c864b4cbc4980ba497de28ac8df2b8aefee4dbc3b4eeb173cc981508c5ed20a924251ed2ee86981d53c90960374676d76901fcc4de6d36884ee33c6b7c2c21c78d935420902b1b027eb44a90b62de1ea6641d50cdca3078dd39b6f43c1189403f91e83ab12d6b520e030a25ffb5886e904824405e98954b70a3de2c35d2e8a340b4814462409220f964696290308a672e1a69119d201d8605ced6908a5dab4606940ba42d65a1b6248a81984493e9a07459b8016940f303098695e2cfabfccf89f9682492942bc8a40841fcbc7e8c1abe9934722299bd90c4d2fa2b9916e663eb852d2e4890d76f4401233f8594d66bd15d7bdcad24403c280bc4c8eb077b3a0c63146a22d6285e3b43a88918848a3f38f2ea60102baf5f98e16e2409e34dd6c5f491b18dd76b1d3c392ae59e00c4c8eb875b44e4bc241e47434891d32a65400ea56d2bf3f3faa169ac30a1275ba4320ec46af8723169391070f0218ccac3a739b4c02b2e824d8bc7f8d1983f380f0a4e92644e152db5130934a5f244a0c4ab61f655bc24c8c69aef53c4e48930200590cca5b3d437fffc20cf97bc369a994644b48164c480660dca3f7b84415a4a0b6ad5488be804e9302c70b61e903e8d0c280b4853ca428d491433080364124d4a813288011510943afbab06ca1d0e2b11583b638d34fa28550c481f68de357ca76e5d36357c99a468d3d4f09522a9d5f08d49ec66e1640d5f853c1132357ca5722064ace1cb0005ef395dc3f7dbcb139143a38818d01282b47cf34fbbf769f61aa9890119506e01172a05d36869412804ab501af9be3e8d8a675a02a43b6561fe248a7924049944932a1a651203ca0f920ed19405a50e0859d3f28154026b67a391afcd47edb62759c39744b2f0f2fa2d7a0d5f415ebf45afe19b9ad76f716bf84ee7f5236daacec2d6f065e4f55b961abebcbc7e77a21abe2a1907d46bf872418a357cd979fd709c60b286af879aaa792216ab86afc913513850961bd116c1b4c455520134d2095ad65e9b1728f0674e5018f45210d32221e305d148a78f34f55a287940d1e8fc6268148dced7d16b5a40a1bc0e682953169a4493b2a03c62409941eab3b6dcaf35aa41a3af6a5aa6c0dad7ffeaa7c9479a7a2d8b1890012d08a858357c15abe5f241bea9e12b0752aee12b0005457be18f4812357c79a0206410eee9e9aae16b22c6971f249f80470862969dcda6511e998e89c87895f41aced6e8234dbd964f960894f4674e8dc2a097399bc6380ae6ef6c9f2a93d3479a7b2d942c20e609a718ce8ec66065044d9f708a615ae14126d1a4012d3d2847882653a32c41a3aff58d2dfb5cfbebf65a7e1fe5eb357e5e3f155c2147b620afdf9c3492da4ea6862f23afdf5479e205ade13b9dd76f696af872f2fa2d430d5f5e5ebf25a8e1cbceebe704917d38625c5b0ddf76de1abedaa2eab5c5f94b8b014982f2cc1b3140996eee89837408baa841b760142a26429b8fb4f59a0e592250d29ff3d74803887db5b214a661294eaff12e0ce7ef234da0e913cebc355a1090493469404b0fca31a48a6b5aeec0dae29a8665297b6df140a686eff44ea6866f2a684a96a7866f72da28b5862f1b84a36c946af8aa1efd6a357ce33fb3688918cf5bc3d7448c7f53201ddffd5104822e90162117354a3f37f2401ad4f175fba868ce3620bd20fecf246a204169c139692490f98044bf48a980848595e7a291500c284d9635f7a14934292906b4a8202d61ace497e3fcdfb5746aa403937a05a954c3979fd76fe16bf80af2fa2d7a0d5f465e3fd8d36146bec5ade1cbcaebb724357c1979fd62117a0b5cc33712e3e74563fea46af88a35bac3ffe9357cd34008a65ec33788f1f3508c9f17c4fc49d4f095d2484b0ddf79478c2bef63404500e98a40d081d13735e62dbb8f0c480f28ed5bbd22285bdaeb2826b5b4e0ac35d2e8a33429af5956c7bd1d39f7aebdb16bef9d7cb4c07f63b5e9b41ad51dbbd96e356adb76f316b4de8166a7d5785bb39b2e585b796b37bbe0b90656dfb51a3b5b76b3075757ec66bfd5d802cd01dc17bc3a845b81bd46e0b90ad67be079ab6a37c7b00d36f75b8d8d6a5c8fdf763fee9f9fef5be419e853dd6935562a4036e9c38ad5ac6d076bb7806cee00016b81aa60f50190d8c66f6b602dda8ebe041195b7c1c6ef80d0d535ca886ebdb305d6c2b7d9a420c4a8041ba3d51004566f6d05da2172b0f13624a335f401bd612d60ec01a1abab5b31f502c85635a65eb0ba5a896d8d20c0b55dffdebe055f50efedfed82e7d055ddcfc57eba56e777ccb06e2def67c7bc31ddb2b7f5480d2dbf512dab87e7fd77e5ffa4a3aa18957b65ee0367ffcb16275fcb16b59d66f47d7fb1f1b2bf68a75b67bb9bf77717a7672da2895e1566fcad6e1d14ff175cd7fd67e1895add3fdb3f393d3f84b6ff1ebd55abdf643af6cfd7eb17f7a13df77675cb6ac8f47c7fb678dd2eae4cbe3c41ef5c7eec31a1cb4179f8ee95aa029587973727070b67f0e56aeaebea96ca0fdd6366b6b91579a76892cdb1fec8afd4fda5cafdaefc18a967575f4d3f9214490b7b037ed37151b30a04f5757fb8d4addeeff88b6020bebeb6b6bd4ad7b87bba7eb0de040e8a117e2afbdddbdc37dc0f38613d7fb626f74ec8d8d87c76eb7ff64fff9e7f1cdeef1deee39e8b1c9bdf3c52ebb4ffd895d2ddb47c7e7f6f9fee927b2fadeb337eebbf60ae849487b59a9932e049d1b736cd9debf3e3ab7acefe8cb617f58c482e70631b96e3fff08dc14b662c6f8a3ce97fe933b02c72a6ae39d9fa0f94f6037f018db1c0adebef4155ad57c6ebd7f7a5f7da12ff6bb7613781f6d63371a76297803bbd5aadb939e3ba69b8643148cd012f4ea0a7dcd1d3db88c0d83b1dcacd4b7dfd67fa8e3315ffa8adee1a5f5e22530dd3e5da48662ddd07ad475944e0663057ce5c17dfa30993c83f744efdcbf75c6fed8a20e8f8c62bbfae1ef35ebde75409f3f809e3fb57f3b39c33ba3cdc9ae16defaf0e4131c27ab60fc9c9cbdaf8103f13bb0f0b2b1fd626fd8cf6000d2b7088fbba04fbb8d6addeefed8008792dd8df58b529f437998dcf73b2e54e479bdfbfd9b0a7863eab4f42130350c302e311658e3c1678f0328b7fe78d21f3f26fa3d39105883011ec6d4b9ebc08975b0e6e97b74f4ae57d7d60ed3c70ce9fa15fbc307bb840ebfcdeebde3b97f96be76e31645c61419574f8dd2531d2e3c374acff4453ab8d0027a407a5fed558f7fbf3c7ee35e5df69c83778feed5c1e3756df4dfebdaf15fedda53f7667c59b9aef57a1defb2eb5ebdab5ed72e6b9faf7fe95e9d1f5fb957bffcf4fbf5e9c0bd38a85cee1fef3957073717d797fdb39f27b5f3cbd3bd76f5e0c239fcf7a97b71b47d76d1f9d5f9f9d3f3e7cac3e4f3d5fef6e7c1e7dee79f8fb68e07bbd593f39be7cf87955fedffd96de7c1ddd906c3d6629f6b2ceb3fbdfec8b527f78f6e62b8f18723ea4e6722f0e4c3c875bfd8957f5476123efa3f504b01021e0314000000080052998951643d7ca94e100000520c0100070018000000000001000000b481000000006e79616e2e736855540500030b05d15f75780b000104e803000004e8030000504b050600000000010001004d0000008f10000000000d0a2d2d35386632366631626364653230613734633136396233383465303233333434302d2d0d0a")
a = a.replace(b'--58f26f1bcde20a74c169b384e0233440\r\nContent-Disposition: form-data; name="zip"; filename="nyan.zip"\r\n\r\n', b"")
print(a)
open("nyan.zip", "wb").write(a)
| 2,289.25
| 8,983
| 0.993448
| 32
| 9,157
| 284.28125
| 0.65625
| 0.001539
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.631711
| 0.00131
| 9,157
| 4
| 8,984
| 2,289.25
| 0.36304
| 0
| 0
| 0
| 0
| 0.25
| 0.991592
| 0.987879
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.25
| 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
| 1
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
975d6e40e16d587438511bdb629057b7e4d1156c
| 546,092
|
py
|
Python
|
experiment_results/sim_product_state_2_copies_20190610T110047Z.py
|
carstenblank/Quantum-classifier-with-tailored-quantum-kernels---Supplemental
|
7c3188f0b71e825bc8ce2b1577a93d10b34abdbc
|
[
"Apache-2.0"
] | 11
|
2020-02-18T14:14:40.000Z
|
2021-10-10T12:19:23.000Z
|
experiment_results/sim_product_state_2_copies_20190610T110047Z.py
|
carstenblank/Quantum-classifier-with-tailored-quantum-kernels---Supplemental
|
7c3188f0b71e825bc8ce2b1577a93d10b34abdbc
|
[
"Apache-2.0"
] | null | null | null |
experiment_results/sim_product_state_2_copies_20190610T110047Z.py
|
carstenblank/Quantum-classifier-with-tailored-quantum-kernels---Supplemental
|
7c3188f0b71e825bc8ce2b1577a93d10b34abdbc
|
[
"Apache-2.0"
] | 2
|
2020-07-08T23:17:01.000Z
|
2021-09-27T03:13:32.000Z
|
# -*- coding: utf-8 -*-
# Copyright 2019 Carsten Blank
#
# 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.
result = {'simulation': {'qobj': {'qobj_id': 'sim_product_state_2_copies_20190610T110047Z', 'config': {'shots': 8192, 'memory_slots': 2, 'max_credits': 315, 'memory': False, 'n_qubits': 7}, 'experiments': [{'instructions': [{'name': 'u3', 'params': [0.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [0.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.0,-pi/2,pi/2) in[1];\nu3(0.0,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [0.1, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [0.1, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.100000000000000,-pi/2,pi/2) in[1];\nu3(0.100000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [0.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [0.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.200000000000000,-pi/2,pi/2) in[1];\nu3(0.200000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [0.30000000000000004, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [0.30000000000000004, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.300000000000000,-pi/2,pi/2) in[1];\nu3(0.300000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [0.4, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [0.4, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.400000000000000,-pi/2,pi/2) in[1];\nu3(0.400000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [0.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [0.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.500000000000000,-pi/2,pi/2) in[1];\nu3(0.500000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [0.6000000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [0.6000000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.600000000000000,-pi/2,pi/2) in[1];\nu3(0.600000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [0.7000000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [0.7000000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.700000000000000,-pi/2,pi/2) in[1];\nu3(0.700000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [0.8, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [0.8, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.800000000000000,-pi/2,pi/2) in[1];\nu3(0.800000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [0.9, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [0.9, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.900000000000000,-pi/2,pi/2) in[1];\nu3(0.900000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [1.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [1.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.00000000000000,-pi/2,pi/2) in[1];\nu3(1.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [1.1, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [1.1, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.10000000000000,-pi/2,pi/2) in[1];\nu3(1.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [1.2000000000000002, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [1.2000000000000002, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.20000000000000,-pi/2,pi/2) in[1];\nu3(1.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [1.3, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [1.3, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.30000000000000,-pi/2,pi/2) in[1];\nu3(1.30000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [1.4000000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [1.4000000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.40000000000000,-pi/2,pi/2) in[1];\nu3(1.40000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [1.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [1.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.50000000000000,-pi/2,pi/2) in[1];\nu3(1.50000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [1.6, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [1.6, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.60000000000000,-pi/2,pi/2) in[1];\nu3(1.60000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [1.7000000000000002, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [1.7000000000000002, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.70000000000000,-pi/2,pi/2) in[1];\nu3(1.70000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [1.8, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [1.8, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.80000000000000,-pi/2,pi/2) in[1];\nu3(1.80000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [1.9000000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [1.9000000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['1.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.90000000000000,-pi/2,pi/2) in[1];\nu3(1.90000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [2.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [2.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.00000000000000,-pi/2,pi/2) in[1];\nu3(2.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [2.1, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [2.1, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.10000000000000,-pi/2,pi/2) in[1];\nu3(2.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [2.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [2.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.20000000000000,-pi/2,pi/2) in[1];\nu3(2.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [2.3000000000000003, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [2.3000000000000003, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.30000000000000,-pi/2,pi/2) in[1];\nu3(2.30000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [2.4000000000000004, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [2.4000000000000004, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.40000000000000,-pi/2,pi/2) in[1];\nu3(2.40000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [2.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [2.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.50000000000000,-pi/2,pi/2) in[1];\nu3(2.50000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [2.6, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [2.6, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.60000000000000,-pi/2,pi/2) in[1];\nu3(2.60000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [2.7, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [2.7, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.70000000000000,-pi/2,pi/2) in[1];\nu3(2.70000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [2.8000000000000003, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [2.8000000000000003, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.80000000000000,-pi/2,pi/2) in[1];\nu3(2.80000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [2.9000000000000004, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [2.9000000000000004, -1.5707963267948966, 1.5707963267948966], 'texparams': ['2.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.90000000000000,-pi/2,pi/2) in[1];\nu3(2.90000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [3.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [3.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.00000000000000,-pi/2,pi/2) in[1];\nu3(3.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [3.1, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [3.1, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.10000000000000,-pi/2,pi/2) in[1];\nu3(3.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [3.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [3.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.20000000000000,-pi/2,pi/2) in[1];\nu3(3.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [3.3000000000000003, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [3.3000000000000003, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.30000000000000,-pi/2,pi/2) in[1];\nu3(3.30000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [3.4000000000000004, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [3.4000000000000004, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.40000000000000,-pi/2,pi/2) in[1];\nu3(3.40000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [3.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [3.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.50000000000000,-pi/2,pi/2) in[1];\nu3(3.50000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [3.6, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [3.6, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.60000000000000,-pi/2,pi/2) in[1];\nu3(3.60000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [3.7, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [3.7, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.70000000000000,-pi/2,pi/2) in[1];\nu3(3.70000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [3.8000000000000003, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [3.8000000000000003, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.80000000000000,-pi/2,pi/2) in[1];\nu3(3.80000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [3.9000000000000004, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [3.9000000000000004, -1.5707963267948966, 1.5707963267948966], 'texparams': ['3.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.90000000000000,-pi/2,pi/2) in[1];\nu3(3.90000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [4.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [4.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.00000000000000,-pi/2,pi/2) in[1];\nu3(4.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [4.1000000000000005, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [4.1000000000000005, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.10000000000000,-pi/2,pi/2) in[1];\nu3(4.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [4.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [4.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.20000000000000,-pi/2,pi/2) in[1];\nu3(4.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [4.3, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [4.3, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.30000000000000,-pi/2,pi/2) in[1];\nu3(4.30000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [4.4, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [4.4, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.40000000000000,-pi/2,pi/2) in[1];\nu3(4.40000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [4.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [4.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.50000000000000,-pi/2,pi/2) in[1];\nu3(4.50000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [4.6000000000000005, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [4.6000000000000005, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.60000000000000,-pi/2,pi/2) in[1];\nu3(4.60000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [4.7, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [4.7, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.70000000000000,-pi/2,pi/2) in[1];\nu3(4.70000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [4.800000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [4.800000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.80000000000000,-pi/2,pi/2) in[1];\nu3(4.80000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [4.9, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [4.9, -1.5707963267948966, 1.5707963267948966], 'texparams': ['4.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.90000000000000,-pi/2,pi/2) in[1];\nu3(4.90000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [5.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [5.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.00000000000000,-pi/2,pi/2) in[1];\nu3(5.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [5.1000000000000005, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [5.1000000000000005, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.10000000000000,-pi/2,pi/2) in[1];\nu3(5.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [5.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [5.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.20000000000000,-pi/2,pi/2) in[1];\nu3(5.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [5.300000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [5.300000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.3', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.30000000000000,-pi/2,pi/2) in[1];\nu3(5.30000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [5.4, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [5.4, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.4', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.40000000000000,-pi/2,pi/2) in[1];\nu3(5.40000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [5.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [5.5, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.5', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.50000000000000,-pi/2,pi/2) in[1];\nu3(5.50000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [5.6000000000000005, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [5.6000000000000005, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.6', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.60000000000000,-pi/2,pi/2) in[1];\nu3(5.60000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [5.7, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [5.7, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.7', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.70000000000000,-pi/2,pi/2) in[1];\nu3(5.70000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [5.800000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [5.800000000000001, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.8', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.80000000000000,-pi/2,pi/2) in[1];\nu3(5.80000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [5.9, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [5.9, -1.5707963267948966, 1.5707963267948966], 'texparams': ['5.9', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.90000000000000,-pi/2,pi/2) in[1];\nu3(5.90000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [6.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['6.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [6.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['6.0', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(6.00000000000000,-pi/2,pi/2) in[1];\nu3(6.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [6.1000000000000005, -1.5707963267948966, 1.5707963267948966], 'texparams': ['6.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [6.1000000000000005, -1.5707963267948966, 1.5707963267948966], 'texparams': ['6.1', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(6.10000000000000,-pi/2,pi/2) in[1];\nu3(6.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}, {'instructions': [{'name': 'u3', 'params': [6.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['6.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [6], 'memory': []}, {'name': 'u3', 'params': [6.2, -1.5707963267948966, 1.5707963267948966], 'texparams': ['6.2', '- \\frac{\\pi}{2}', '\\frac{\\pi}{2}'], 'qubits': [5], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [3], 'memory': []}, {'name': 'u3', 'params': [1.5707963267948966, 1.5707963267948966, 4.71238898038469], 'texparams': ['3.14159265358979 - \\frac{\\pi}{2}', '\\frac{\\pi}{2}', '\\frac{3 \\pi}{2}'], 'qubits': [2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [1], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [3], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [1, 4], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [2, 5], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [2], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 2], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [3, 6], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u1', 'params': [-0.7853981633974483], 'texparams': ['- \\frac{\\pi}{4}'], 'qubits': [3], 'memory': []}, {'name': 'u1', 'params': [0.7853981633974483], 'texparams': ['\\frac{\\pi}{4}'], 'qubits': [0], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [0, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.141592653589793], 'texparams': ['0', '\\pi'], 'qubits': [0], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [6], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [6, 3], 'memory': []}, {'name': 'u2', 'params': [0.0, 3.9269908169872414], 'texparams': ['0', '\\frac{5 \\pi}{4}'], 'qubits': [5], 'memory': []}, {'name': 'cx', 'params': [], 'texparams': [], 'qubits': [5, 2], 'memory': []}, {'name': 'barrier', 'params': [], 'texparams': [], 'qubits': [0, 1, 2, 3, 4, 5, 6], 'memory': []}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [0], 'memory': [0]}, {'name': 'measure', 'params': [], 'texparams': [], 'qubits': [4], 'memory': [1]}], 'header': {'n_qubits': 7, 'memory_slots': 2, 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'clbit_labels': [['c', 0], ['c', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'creg_sizes': [['c', 2]], 'name': 'improvement', 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(6.20000000000000,-pi/2,pi/2) in[1];\nu3(6.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n'}, 'config': {'memory_slots': 2, 'n_qubits': 7}}], 'header': {'backend_name': 'qasm_simulator'}, 'type': 'QASM', 'schema_version': '1.0.0'}, 'date': '2019-06-10T11:01:01.573766', 'job_id': '0ff92bf4-b21d-4712-9dab-117afead5a16', 'backend_name': 'qasm_simulator', 'backend_version': '0.1.1', 'job_status': 'DONE', 'results': [{'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.0,-pi/2,pi/2) in[1];\nu3(0.0,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3750932186, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1636, '0x0': 2487, '0x2': 2523, '0x3': 1546}}, 'shots': 8192, 'time_taken': 2.354069157, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.100000000000000,-pi/2,pi/2) in[1];\nu3(0.100000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2099516770, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1490, '0x0': 2655, '0x2': 2435, '0x3': 1612}}, 'shots': 8192, 'time_taken': 2.316950529, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.200000000000000,-pi/2,pi/2) in[1];\nu3(0.200000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 661109116, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1436, '0x0': 2722, '0x2': 2344, '0x3': 1690}}, 'shots': 8192, 'time_taken': 2.425879777, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.300000000000000,-pi/2,pi/2) in[1];\nu3(0.300000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1145335825, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1344, '0x0': 2879, '0x2': 2288, '0x3': 1681}}, 'shots': 8192, 'time_taken': 2.5238233450000003, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.400000000000000,-pi/2,pi/2) in[1];\nu3(0.400000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 4182758655, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1152, '0x0': 2963, '0x2': 2294, '0x3': 1783}}, 'shots': 8192, 'time_taken': 2.509897305, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.500000000000000,-pi/2,pi/2) in[1];\nu3(0.500000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2835158083, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1133, '0x0': 3049, '0x2': 2166, '0x3': 1844}}, 'shots': 8192, 'time_taken': 2.466952439, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.600000000000000,-pi/2,pi/2) in[1];\nu3(0.600000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 877863386, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1013, '0x0': 3202, '0x2': 2177, '0x3': 1800}}, 'shots': 8192, 'time_taken': 2.2712684860000003, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.700000000000000,-pi/2,pi/2) in[1];\nu3(0.700000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1923886341, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 869, '0x0': 3204, '0x2': 2171, '0x3': 1948}}, 'shots': 8192, 'time_taken': 2.148977822, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.800000000000000,-pi/2,pi/2) in[1];\nu3(0.800000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2241821404, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 749, '0x0': 3459, '0x2': 2105, '0x3': 1879}}, 'shots': 8192, 'time_taken': 2.142341445, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(0.900000000000000,-pi/2,pi/2) in[1];\nu3(0.900000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1942687842, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 681, '0x0': 3407, '0x2': 2235, '0x3': 1869}}, 'shots': 8192, 'time_taken': 2.074930117, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.00000000000000,-pi/2,pi/2) in[1];\nu3(1.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2144958822, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 609, '0x0': 3512, '0x2': 2192, '0x3': 1879}}, 'shots': 8192, 'time_taken': 2.077850228, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.10000000000000,-pi/2,pi/2) in[1];\nu3(1.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3155567409, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 518, '0x0': 3618, '0x2': 2178, '0x3': 1878}}, 'shots': 8192, 'time_taken': 2.113101174, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.20000000000000,-pi/2,pi/2) in[1];\nu3(1.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 173931154, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 475, '0x0': 3619, '0x2': 2160, '0x3': 1938}}, 'shots': 8192, 'time_taken': 2.117983668, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.30000000000000,-pi/2,pi/2) in[1];\nu3(1.30000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3497892720, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 405, '0x0': 3812, '0x2': 2091, '0x3': 1884}}, 'shots': 8192, 'time_taken': 2.152263136, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.40000000000000,-pi/2,pi/2) in[1];\nu3(1.40000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2271443130, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 371, '0x0': 3740, '0x2': 2137, '0x3': 1944}}, 'shots': 8192, 'time_taken': 2.511483976, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.50000000000000,-pi/2,pi/2) in[1];\nu3(1.50000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1243969513, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 357, '0x0': 3788, '0x2': 2121, '0x3': 1926}}, 'shots': 8192, 'time_taken': 2.508379959, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.60000000000000,-pi/2,pi/2) in[1];\nu3(1.60000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 166471321, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 337, '0x0': 3781, '0x2': 2229, '0x3': 1845}}, 'shots': 8192, 'time_taken': 2.165360917, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.70000000000000,-pi/2,pi/2) in[1];\nu3(1.70000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 125133007, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 336, '0x0': 3708, '0x2': 2179, '0x3': 1969}}, 'shots': 8192, 'time_taken': 2.181538314, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.80000000000000,-pi/2,pi/2) in[1];\nu3(1.80000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3971994914, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 397, '0x0': 3748, '0x2': 2122, '0x3': 1925}}, 'shots': 8192, 'time_taken': 2.40278816, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(1.90000000000000,-pi/2,pi/2) in[1];\nu3(1.90000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3670389324, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 475, '0x0': 3649, '0x2': 2199, '0x3': 1869}}, 'shots': 8192, 'time_taken': 2.252078032, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.00000000000000,-pi/2,pi/2) in[1];\nu3(2.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 840230931, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 515, '0x0': 3591, '0x2': 2170, '0x3': 1916}}, 'shots': 8192, 'time_taken': 2.397563983, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.10000000000000,-pi/2,pi/2) in[1];\nu3(2.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1315075795, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 573, '0x0': 3611, '0x2': 2139, '0x3': 1869}}, 'shots': 8192, 'time_taken': 3.2376709060000004, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.20000000000000,-pi/2,pi/2) in[1];\nu3(2.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1313666564, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 666, '0x0': 3430, '0x2': 2108, '0x3': 1988}}, 'shots': 8192, 'time_taken': 2.572383308, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.30000000000000,-pi/2,pi/2) in[1];\nu3(2.30000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1607460618, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 738, '0x0': 3350, '0x2': 2177, '0x3': 1927}}, 'shots': 8192, 'time_taken': 2.207243205, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.40000000000000,-pi/2,pi/2) in[1];\nu3(2.40000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2870900354, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 859, '0x0': 3283, '0x2': 2169, '0x3': 1881}}, 'shots': 8192, 'time_taken': 2.2033139530000003, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.50000000000000,-pi/2,pi/2) in[1];\nu3(2.50000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1899835324, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 969, '0x0': 3156, '0x2': 2202, '0x3': 1865}}, 'shots': 8192, 'time_taken': 2.254454931, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.60000000000000,-pi/2,pi/2) in[1];\nu3(2.60000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2905829725, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1079, '0x0': 3072, '0x2': 2203, '0x3': 1838}}, 'shots': 8192, 'time_taken': 2.316611387, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.70000000000000,-pi/2,pi/2) in[1];\nu3(2.70000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3370466340, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1152, '0x0': 2956, '0x2': 2251, '0x3': 1833}}, 'shots': 8192, 'time_taken': 2.137187269, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.80000000000000,-pi/2,pi/2) in[1];\nu3(2.80000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2618870294, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1368, '0x0': 2773, '0x2': 2213, '0x3': 1838}}, 'shots': 8192, 'time_taken': 2.515236853, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(2.90000000000000,-pi/2,pi/2) in[1];\nu3(2.90000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1447188266, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1365, '0x0': 2777, '0x2': 2315, '0x3': 1735}}, 'shots': 8192, 'time_taken': 2.464634815, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.00000000000000,-pi/2,pi/2) in[1];\nu3(3.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 188724258, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1445, '0x0': 2713, '0x2': 2339, '0x3': 1695}}, 'shots': 8192, 'time_taken': 2.328321806, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.10000000000000,-pi/2,pi/2) in[1];\nu3(3.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2240369202, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1613, '0x0': 2549, '0x2': 2453, '0x3': 1577}}, 'shots': 8192, 'time_taken': 2.1923534780000002, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.20000000000000,-pi/2,pi/2) in[1];\nu3(3.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3468537338, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1657, '0x0': 2437, '0x2': 2579, '0x3': 1519}}, 'shots': 8192, 'time_taken': 2.0644040710000002, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.30000000000000,-pi/2,pi/2) in[1];\nu3(3.30000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1054879635, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1664, '0x0': 2392, '0x2': 2690, '0x3': 1446}}, 'shots': 8192, 'time_taken': 2.0805630660000003, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.40000000000000,-pi/2,pi/2) in[1];\nu3(3.40000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3027547888, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1750, '0x0': 2380, '0x2': 2740, '0x3': 1322}}, 'shots': 8192, 'time_taken': 2.117722827, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.50000000000000,-pi/2,pi/2) in[1];\nu3(3.50000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1748358997, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1834, '0x0': 2325, '0x2': 2794, '0x3': 1239}}, 'shots': 8192, 'time_taken': 2.2731526730000002, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.60000000000000,-pi/2,pi/2) in[1];\nu3(3.60000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 58696141, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1869, '0x0': 2272, '0x2': 2960, '0x3': 1091}}, 'shots': 8192, 'time_taken': 2.143099888, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.70000000000000,-pi/2,pi/2) in[1];\nu3(3.70000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2017773915, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1929, '0x0': 2219, '0x2': 3014, '0x3': 1030}}, 'shots': 8192, 'time_taken': 2.1983173750000002, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.80000000000000,-pi/2,pi/2) in[1];\nu3(3.80000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 966017574, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1926, '0x0': 2177, '0x2': 3191, '0x3': 898}}, 'shots': 8192, 'time_taken': 2.135538565, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(3.90000000000000,-pi/2,pi/2) in[1];\nu3(3.90000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2928333201, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1917, '0x0': 2157, '0x2': 3327, '0x3': 791}}, 'shots': 8192, 'time_taken': 2.134001342, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.00000000000000,-pi/2,pi/2) in[1];\nu3(4.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2636141218, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 2024, '0x0': 2142, '0x2': 3328, '0x3': 698}}, 'shots': 8192, 'time_taken': 2.268762091, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.10000000000000,-pi/2,pi/2) in[1];\nu3(4.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3535500971, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1962, '0x0': 2145, '0x2': 3464, '0x3': 621}}, 'shots': 8192, 'time_taken': 2.425280185, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.20000000000000,-pi/2,pi/2) in[1];\nu3(4.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3387616906, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1982, '0x0': 2122, '0x2': 3539, '0x3': 549}}, 'shots': 8192, 'time_taken': 2.1070356660000003, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.30000000000000,-pi/2,pi/2) in[1];\nu3(4.30000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3937474151, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1946, '0x0': 2191, '0x2': 3590, '0x3': 465}}, 'shots': 8192, 'time_taken': 2.258429329, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.40000000000000,-pi/2,pi/2) in[1];\nu3(4.40000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 793192246, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1983, '0x0': 2162, '0x2': 3671, '0x3': 376}}, 'shots': 8192, 'time_taken': 2.378522755, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.50000000000000,-pi/2,pi/2) in[1];\nu3(4.50000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2109882870, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1908, '0x0': 2208, '0x2': 3695, '0x3': 381}}, 'shots': 8192, 'time_taken': 2.200079644, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.60000000000000,-pi/2,pi/2) in[1];\nu3(4.60000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3208041828, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1897, '0x0': 2123, '0x2': 3817, '0x3': 355}}, 'shots': 8192, 'time_taken': 2.0950629860000003, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.70000000000000,-pi/2,pi/2) in[1];\nu3(4.70000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 4050037437, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1973, '0x0': 2217, '0x2': 3681, '0x3': 321}}, 'shots': 8192, 'time_taken': 2.070066872, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.80000000000000,-pi/2,pi/2) in[1];\nu3(4.80000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1018078324, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1926, '0x0': 2230, '0x2': 3708, '0x3': 328}}, 'shots': 8192, 'time_taken': 2.103998031, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(4.90000000000000,-pi/2,pi/2) in[1];\nu3(4.90000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3456672281, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1999, '0x0': 2183, '0x2': 3647, '0x3': 363}}, 'shots': 8192, 'time_taken': 2.0680511320000003, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.00000000000000,-pi/2,pi/2) in[1];\nu3(5.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1760984623, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1966, '0x0': 2151, '0x2': 3677, '0x3': 398}}, 'shots': 8192, 'time_taken': 2.0933246690000002, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.10000000000000,-pi/2,pi/2) in[1];\nu3(5.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 863779474, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1967, '0x0': 2227, '0x2': 3576, '0x3': 422}}, 'shots': 8192, 'time_taken': 2.067855233, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.20000000000000,-pi/2,pi/2) in[1];\nu3(5.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1142597314, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1990, '0x0': 2145, '0x2': 3543, '0x3': 514}}, 'shots': 8192, 'time_taken': 2.046269309, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.30000000000000,-pi/2,pi/2) in[1];\nu3(5.30000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 4168335458, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1969, '0x0': 2177, '0x2': 3482, '0x3': 564}}, 'shots': 8192, 'time_taken': 2.132819108, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.40000000000000,-pi/2,pi/2) in[1];\nu3(5.40000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3542982226, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1992, '0x0': 2220, '0x2': 3353, '0x3': 627}}, 'shots': 8192, 'time_taken': 2.237604766, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.50000000000000,-pi/2,pi/2) in[1];\nu3(5.50000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1111929023, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1961, '0x0': 2173, '0x2': 3292, '0x3': 766}}, 'shots': 8192, 'time_taken': 2.223681157, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.60000000000000,-pi/2,pi/2) in[1];\nu3(5.60000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2118434241, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1894, '0x0': 2196, '0x2': 3200, '0x3': 902}}, 'shots': 8192, 'time_taken': 2.058536322, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.70000000000000,-pi/2,pi/2) in[1];\nu3(5.70000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3250494130, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1844, '0x0': 2197, '0x2': 3177, '0x3': 974}}, 'shots': 8192, 'time_taken': 2.074152299, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.80000000000000,-pi/2,pi/2) in[1];\nu3(5.80000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 33723319, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1857, '0x0': 2269, '0x2': 2914, '0x3': 1152}}, 'shots': 8192, 'time_taken': 2.138888017, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(5.90000000000000,-pi/2,pi/2) in[1];\nu3(5.90000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 613664103, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1836, '0x0': 2360, '0x2': 2763, '0x3': 1233}}, 'shots': 8192, 'time_taken': 2.0949718440000002, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(6.00000000000000,-pi/2,pi/2) in[1];\nu3(6.00000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 1342118396, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1769, '0x0': 2384, '0x2': 2755, '0x3': 1284}}, 'shots': 8192, 'time_taken': 2.070095313, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(6.10000000000000,-pi/2,pi/2) in[1];\nu3(6.10000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 3167846467, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1732, '0x0': 2419, '0x2': 2592, '0x3': 1449}}, 'shots': 8192, 'time_taken': 2.0597456910000003, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}, {'header': {'creg_sizes': [['c', 2]], 'name': 'improvement', 'clbit_labels': [['c', 0], ['c', 1]], 'qubit_labels': [['a', 0], ['m', 0], ['d', 0], ['d', 1], ['l', 0], ['in', 0], ['in', 1]], 'qreg_sizes': [['a', 1], ['m', 1], ['d', 2], ['l', 1], ['in', 2]], 'compiled_circuit_qasm': 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg a[1];\nqreg m[1];\nqreg d[2];\nqreg l[1];\nqreg in[2];\ncreg c[2];\nu3(6.20000000000000,-pi/2,pi/2) in[1];\nu3(6.20000000000000,-pi/2,pi/2) in[0];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[1];\nu3(3.14159265358979 - pi/2,pi/2,3*pi/2) d[0];\nu2(0,pi) m[0];\ncx m[0],d[0];\ncx m[0],d[1];\ncx m[0],l[0];\nu2(0,pi) d[1];\ncx in[1],d[1];\nu2(0,pi) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\nu2(0,pi) d[0];\ncx in[0],d[0];\nu2(0,pi) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\nu2(0,pi) a[0];\ncx a[0],in[0];\nu1(pi/4) in[0];\ncx d[0],in[0];\nu1(-pi/4) in[0];\ncx a[0],in[0];\nu2(0,5*pi/4) in[0];\nu1(pi/4) d[0];\ncx a[0],d[0];\nu1(pi/4) a[0];\nu1(-pi/4) d[0];\ncx a[0],d[0];\ncx a[0],in[1];\nu1(pi/4) in[1];\ncx d[1],in[1];\nu1(-pi/4) in[1];\ncx a[0],in[1];\nu2(0,5*pi/4) in[1];\nu1(pi/4) d[1];\ncx a[0],d[1];\nu1(pi/4) a[0];\nu1(-pi/4) d[1];\ncx a[0],d[1];\ncx in[1],d[1];\nu2(0,pi) a[0];\ncx in[0],d[0];\nbarrier a[0],m[0],d[0],d[1],l[0],in[0],in[1];\nmeasure l[0] -> c[1];\nmeasure a[0] -> c[0];\n', 'memory_slots': 2, 'n_qubits': 7}, 'seed': 2137166391, 'success': True, 'status': 'DONE', 'data': {'counts': {'0x1': 1710, '0x0': 2483, '0x2': 2556, '0x3': 1443}}, 'shots': 8192, 'time_taken': 2.1513021670000003, 'metadata': {'method': 'statevector', 'omp_shot_threads': 1, 'omp_state_threads': 8}}], 'classification': [-0.015380859375, 0.041748046875, 0.0771484375, 0.11328125, 0.15869140625, 0.194580078125, 0.22119140625, 0.2578125, 0.30322265625, 0.2880859375, 0.316162109375, 0.341796875, 0.356689453125, 0.390625, 0.3876953125, 0.39501953125, 0.37353515625, 0.385986328125, 0.385009765625, 0.34716796875, 0.344482421875, 0.337890625, 0.32275390625, 0.288330078125, 0.2607421875, 0.225830078125, 0.19873046875, 0.169189453125, 0.125732421875, 0.1015625, 0.076171875, 0.00732421875, -0.0341796875, -0.06298828125, -0.09619140625, -0.1298828125, -0.178955078125, -0.206787109375, -0.249267578125, -0.2802734375, -0.306640625, -0.32470703125, -0.347900390625, -0.3515625, -0.38037109375, -0.367919921875, -0.39501953125, -0.38037109375, -0.37548828125, -0.37841796875, -0.377685546875, -0.353271484375, -0.350830078125, -0.330810546875, -0.304931640625, -0.282470703125, -0.24365234375, -0.225830078125, -0.164794921875, -0.122802734375, -0.1044921875, -0.0556640625, -0.04150390625], 'noise_model': {'errors': [{'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'id', 'qubits': [0]}], [{'name': 'z', 'qubits': [0]}], [{'name': 'reset', 'qubits': [0]}]], 'probabilities': [0.9964499009924005, 0.001462440434750355, 0.0020876585728492048], 'gate_qubits': [[0]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99995572, 0. ],
[0. , 0.99906505]]), array([[-0.00941084, 0. ],
[ 0. , 0.00941923]]), array([[0. , 0.04219358],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[1]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.9999664 , 0. ],
[0. , 0.99911635]]), array([[-0.0081972 , 0. ],
[ 0. , 0.00820417]]), array([[0. , 0.04122157],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[2]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'id', 'qubits': [0]}], [{'name': 'z', 'qubits': [0]}], [{'name': 'reset', 'qubits': [0]}]], 'probabilities': [0.9980196446248024, 0.0004542827701613801, 0.0015260726050362328], 'gate_qubits': [[3]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'id', 'qubits': [0]}], [{'name': 'z', 'qubits': [0]}], [{'name': 'reset', 'qubits': [0]}]], 'probabilities': [0.997324998597777, 0.0008272482874253661, 0.0018477531147975679], 'gate_qubits': [[4]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99997363, 0. ],
[0. , 0.99793849]]), array([[-0.00726263, 0. ],
[ 0. , 0.00727744]]), array([[0. , 0.06376362],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[5]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99983348, 0. ],
[0. , 0.99915936]]), array([[-0.01824865, 0. ],
[ 0. , 0.01826096]]), array([[0. , 0.03670312],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[6]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99987222, 0. ],
[0. , 0.99814281]]), array([[-0.01598597, 0. ],
[ 0. , 0.01601366]]), array([[0. , 0.05877501],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[7]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99998844, 0. ],
[0. , 0.99951905]]), array([[-0.00480749, 0. ],
[ 0. , 0.00480975]]), array([[0. , 0.03063544],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[8]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99994213, 0. ],
[0. , 0.99863272]]), array([[-0.01075852, 0. ],
[ 0. , 0.01077263]]), array([[0. , 0.05115319],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[9]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99983506, 0. ],
[0. , 0.99896403]]), array([[-0.01816187, 0. ],
[ 0. , 0.0181777 ]]), array([[0. , 0.04171864],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[10]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99997113, 0. ],
[0. , 0.99900914]]), array([[-0.00759837, 0. ],
[ 0. , 0.00760568]]), array([[0. , 0.04385079],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[11]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99994634, 0. ],
[0. , 0.99916234]]), array([[-0.01035979, 0. ],
[ 0. , 0.01036792]]), array([[0. , 0.03958684],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[12]]}, {'type': 'qerror', 'operations': ['u2'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99994943, 0. ],
[0. , 0.99750598]]), array([[-0.01005713, 0. ],
[ 0. , 0.01008177]]), array([[0. , 0.06985824],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[13]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'id', 'qubits': [0]}], [{'name': 'z', 'qubits': [0]}], [{'name': 'reset', 'qubits': [0]}]], 'probabilities': [0.9929145439197898, 0.0029144972528285062, 0.00417095882738161], 'gate_qubits': [[0]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.9999116 , 0. ],
[0. , 0.99813083]]), array([[-0.01329648, 0. ],
[ 0. , 0.0133202 ]]), array([[0. , 0.05964417],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[1]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99993292, 0. ],
[0. , 0.99823336]]), array([[-0.01158233, 0. ],
[ 0. , 0.01160205]]), array([[0. , 0.05827133],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[2]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'id', 'qubits': [0]}], [{'name': 'z', 'qubits': [0]}], [{'name': 'reset', 'qubits': [0]}]], 'probabilities': [0.9960434174298521, 0.0009067662576712168, 0.003049816312476694], 'gate_qubits': [[3]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'id', 'qubits': [0]}], [{'name': 'z', 'qubits': [0]}], [{'name': 'reset', 'qubits': [0]}]], 'probabilities': [0.9946578371677851, 0.0016500707941930484, 0.003692092038021788], 'gate_qubits': [[4]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99994747, 0. ],
[0. , 0.99588102]]), array([[-0.01024968, 0. ],
[ 0. , 0.01029153]]), array([[0. , 0.09008368],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[5]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99966749, 0. ],
[0. , 0.99831902]]), array([[-0.02578577, 0. ],
[ 0. , 0.0258206 ]]), array([[0. , 0.05188857],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[6]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99974537, 0. ],
[0. , 0.99628821]]), array([[-0.02256546, 0. ],
[ 0. , 0.02264376]]), array([[0. , 0.0830486],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[7]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99997691, 0. ],
[0. , 0.99903831]]), array([[-0.00679554, 0. ],
[ 0. , 0.00680193]]), array([[0. , 0.04331488],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[8]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99988456, 0. ],
[0. , 0.997267 ]]), array([[-0.015194 , 0. ],
[ 0. , 0.01523388]]), array([[0. , 0.0722942],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[9]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99967078, 0. ],
[0. , 0.99792861]]), array([[-0.0256581, 0. ],
[ 0. , 0.0257029]]), array([[0. , 0.05897338],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[10]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99994238, 0. ],
[0. , 0.99801915]]), array([[-0.01073505, 0. ],
[ 0. , 0.01075573]]), array([[0. , 0.06198456],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[11]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99989285, 0. ],
[0. , 0.99832523]]), array([[-0.01463866, 0. ],
[ 0. , 0.01466165]]), array([[0. , 0.05596231],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[12]]}, {'type': 'qerror', 'operations': ['u3'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99989935, 0. ],
[0. , 0.99501769]]), array([[-0.01418733, 0. ],
[ 0. , 0.01425693]]), array([[0. , 0.09867387],
[0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[13]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.9997139 , 0. ],
[0. , 0.99391032]]), array([[-0.02391887, 0. ],
[ 0. , 0.02405853]]), array([[0. , 0.10753358],
[0. , 0. ]])]}, {'name': 'id', 'qubits': [1]}], [{'name': 'kraus', 'qubits': [0], 'params': [array([[0.9997139 , 0. ],
[0. , 0.99391032]]), array([[-0.02391887, 0. ],
[ 0. , 0.02405853]]), array([[0. , 0.10753358],
[0. , 0. ]])]}, {'name': 'z', 'qubits': [1]}], [{'name': 'kraus', 'qubits': [0], 'params': [array([[0.9997139 , 0. ],
[0. , 0.99391032]]), array([[-0.02391887, 0. ],
[ 0. , 0.02405853]]), array([[0. , 0.10753358],
[0. , 0. ]])]}, {'name': 'reset', 'qubits': [1]}]], 'probabilities': [0.9770916351576103, 0.009360020482744723, 0.013548344359644915], 'gate_qubits': [[1, 0]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.999587 , 0. , 0. , 0. ],
[0. , 0.9948333 , 0. , 0. ],
[0. , 0. , 0.99505052, 0. ],
[0. , 0. , 0. , 0.99031839]]), array([[-0.01887481, -0. , 0. , 0. ],
[-0. , -0.01878504, 0. , 0. ],
[ 0. , 0. , 0.01896086, 0. ],
[ 0. , 0. , 0. , 0.01887068]]), array([[0. , 0. , 0.09510715, 0. ],
[0. , 0. , 0. , 0.09465485],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.02166569, 0. , -0. , 0. ],
[ 0. , 0.02176922, 0. , 0. ],
[-0. , 0. , -0.02156737, 0. ],
[ 0. , 0. , 0. , 0.02167042]]), array([[ 0.0004091 , -0. , -0. , 0. ],
[-0. , -0.00041106, 0. , 0. ],
[-0. , 0. , -0.00041097, 0. ],
[ 0. , 0. , 0. , 0.00041293]]), array([[-0. , 0. , -0.00206141, 0. ],
[ 0. , 0. , 0. , 0.00207126],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.09734673, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.09690494],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00183816, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.00184654],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.0092622],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[1, 2]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99976967, 0. ],
[0. , 0.9938924 ]]), array([[-0.02146162, 0. ],
[ 0. , 0.02158853]]), array([[0. , 0.10822122],
[0. , 0. ]])]}, {'name': 'id', 'qubits': [1]}], [{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99976967, 0. ],
[0. , 0.9938924 ]]), array([[-0.02146162, 0. ],
[ 0. , 0.02158853]]), array([[0. , 0.10822122],
[0. , 0. ]])]}, {'name': 'z', 'qubits': [1]}], [{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99976967, 0. ],
[0. , 0.9938924 ]]), array([[-0.02146162, 0. ],
[ 0. , 0.02158853]]), array([[0. , 0.10822122],
[0. , 0. ]])]}, {'name': 'reset', 'qubits': [1]}]], 'probabilities': [0.9863659868672717, 0.003110184411602801, 0.01052382872112545], 'gate_qubits': [[2, 3]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'id', 'qubits': [0]}, {'name': 'id', 'qubits': [1]}], [{'name': 'z', 'qubits': [0]}, {'name': 'id', 'qubits': [1]}], [{'name': 'reset', 'qubits': [0]}, {'name': 'id', 'qubits': [1]}], [{'name': 'id', 'qubits': [0]}, {'name': 'z', 'qubits': [1]}], [{'name': 'z', 'qubits': [0]}, {'name': 'z', 'qubits': [1]}], [{'name': 'reset', 'qubits': [0]}, {'name': 'z', 'qubits': [1]}], [{'name': 'id', 'qubits': [0]}, {'name': 'reset', 'qubits': [1]}], [{'name': 'z', 'qubits': [0]}, {'name': 'reset', 'qubits': [1]}], [{'name': 'reset', 'qubits': [0]}, {'name': 'reset', 'qubits': [1]}]], 'probabilities': [0.9678364429486117, 0.005634053306387972, 0.012717873051886302, 0.003091806560520622, 1.799829206879549e-05, 4.0627942483643696e-05, 0.010462804239379868, 6.090698200966394e-05, 0.00013748667665145585], 'gate_qubits': [[4, 3]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'id', 'qubits': [0]}, {'name': 'kraus', 'qubits': [1], 'params': [array([[0.99887089, 0. ],
[0. , 0.99283483]]), array([[-0.04750733, 0. ],
[ 0. , 0.04779615]]), array([[0. , 0.10951951],
[0. , 0. ]])]}], [{'name': 'z', 'qubits': [0]}, {'name': 'kraus', 'qubits': [1], 'params': [array([[0.99887089, 0. ],
[0. , 0.99283483]]), array([[-0.04750733, 0. ],
[ 0. , 0.04779615]]), array([[0. , 0.10951951],
[0. , 0. ]])]}], [{'name': 'reset', 'qubits': [0]}, {'name': 'kraus', 'qubits': [1], 'params': [array([[0.99887089, 0. ],
[0. , 0.99283483]]), array([[-0.04750733, 0. ],
[ 0. , 0.04779615]]), array([[0. , 0.10951951],
[0. , 0. ]])]}]], 'probabilities': [0.9816296617996338, 0.005640329179750405, 0.012730009020615718], 'gate_qubits': [[4, 10]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99980408, 0. ],
[0. , 0.98435947]]), array([[-0.0197941 , 0. ],
[ 0. , 0.02010467]]), array([[0. , 0.17502069],
[0. , 0. ]])]}, {'name': 'id', 'qubits': [1]}], [{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99980408, 0. ],
[0. , 0.98435947]]), array([[-0.0197941 , 0. ],
[ 0. , 0.02010467]]), array([[0. , 0.17502069],
[0. , 0. ]])]}, {'name': 'z', 'qubits': [1]}], [{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99980408, 0. ],
[0. , 0.98435947]]), array([[-0.0197941 , 0. ],
[ 0. , 0.02010467]]), array([[0. , 0.17502069],
[0. , 0. ]])]}, {'name': 'reset', 'qubits': [1]}]], 'probabilities': [0.979770204157941, 0.00620589312538694, 0.014023902716672088], 'gate_qubits': [[5, 4]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.9985462 , 0. , 0. , 0. ],
[0. , 0.98312102, 0. , 0. ],
[0. , 0. , 0.99339376, 0. ],
[0. , 0. , 0. , 0.97804817]]), array([[-0.05013657, -0. , 0. , 0. ],
[-0. , -0.04936208, 0. , 0. ],
[ 0. , 0. , 0.05039661, 0. ],
[ 0. , 0. , 0. , 0.0496181 ]]), array([[0. , 0. , 0.10117911, 0. ],
[0. , 0. , 0. , 0.09961613],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.01976919, 0. , -0. , 0. ],
[ 0. , 0.02007937, 0. , 0. ],
[-0. , 0. , -0.01966718, 0. ],
[ 0. , 0. , 0. , 0.01997576]]), array([[ 0.0009926 , -0. , -0. , 0. ],
[-0. , -0.00100818, 0. , 0. ],
[-0. , 0. , -0.00099775, 0. ],
[ 0. , 0. , 0. , 0.00101341]]), array([[-0. , 0. , -0.00200314, 0. ],
[ 0. , 0. , 0. , 0.00203457],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.17480049, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.17389853],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00877666, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.00882218],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.01771191],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[5, 6]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.99930011, 0. , 0. , 0. ],
[0. , 0.98211276, 0. , 0. ],
[0. , 0. , 0.98820075, 0. ],
[0. , 0. , 0. , 0.97120429]]), array([[-0.03105323, -0. , 0. , 0. ],
[-0. , -0.03051913, 0. , 0. ],
[ 0. , 0. , 0.03140201, 0. ],
[ 0. , 0. , 0. , 0.03086192]]), array([[0. , 0. , 0.14845272, 0. ],
[0. , 0. , 0. , 0.14589942],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.02084629, 0. , -0. , 0. ],
[ 0. , 0.02121111, 0. , 0. ],
[-0. , 0. , -0.02061475, 0. ],
[ 0. , 0. , 0. , 0.02097552]]), array([[ 0.0006478 , -0. , -0. , 0. ],
[-0. , -0.00065913, 0. , 0. ],
[-0. , 0. , -0.00065507, 0. ],
[ 0. , 0. , 0. , 0.00066654]]), array([[-0. , 0. , -0.00309686, 0. ],
[ 0. , 0. , 0. , 0.00315105],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.18449906, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.1824498 ],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.0057333, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.0057977],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.02740857],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[5, 9]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.99850258, 0. , 0. , 0. ],
[0. , 0.9927599 , 0. , 0. ],
[0. , 0. , 0.99452006, 0. ],
[0. , 0. , 0. , 0.98880028]]), array([[-0.01395336, -0. , 0. , 0. ],
[-0. , -0.01387311, 0. , 0. ],
[ 0. , 0. , 0.01400924, 0. ],
[ 0. , 0. , 0. , 0.01392867]]), array([[0. , 0. , 0.08908248, 0. ],
[0. , 0. , 0. , 0.08857014],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.05289007, 0. , -0. , 0. ],
[ 0. , 0.05319602, 0. , 0. ],
[-0. , 0. , -0.05267912, 0. ],
[ 0. , 0. , 0. , 0.05298385]]), array([[ 0.0007391 , -0. , -0. , 0. ],
[-0. , -0.00074338, 0. , 0. ],
[-0. , 0. , -0.00074206, 0. ],
[ 0. , 0. , 0. , 0.00074635]]), array([[-0. , 0. , -0.00471864, 0. ],
[ 0. , 0. , 0. , 0.00474594],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.10678355, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.10635764],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00149222, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.0014982 ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.00952681],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[6, 8]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.99884488, 0. , 0. , 0. ],
[0. , 0.98418345, 0. , 0. ],
[0. , 0. , 0.994861 , 0. ],
[0. , 0. , 0. , 0.98025804]]), array([[-0.01395815, -0. , 0. , 0. ],
[-0. , -0.01375326, 0. , 0. ],
[ 0. , 0. , 0.01401404, 0. ],
[ 0. , 0. , 0. , 0.01380834]]), array([[0. , 0. , 0.08911302, 0. ],
[0. , 0. , 0. , 0.08780498],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.04597448, 0. , -0. , 0. ],
[ 0. , 0.04665937, 0. , 0. ],
[-0. , 0. , -0.04579112, 0. ],
[ 0. , 0. , 0. , 0.04647327]]), array([[ 0.00064246, -0. , -0. , 0. ],
[-0. , -0.00065203, 0. , 0. ],
[-0. , 0. , -0.00064503, 0. ],
[ 0. , 0. , 0. , 0.00065464]]), array([[-0. , 0. , -0.00410166, 0. ],
[ 0. , 0. , 0. , 0.00416277],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.17032498, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.16964564],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00238017, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.0023897 ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.01519573],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[7, 8]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.99941994, 0. , 0. , 0. ],
[0. , 0.98831925, 0. , 0. ],
[0. , 0. , 0.99543377, 0. ],
[0. , 0. , 0. , 0.98437735]]), array([[-0.01396618, -0. , 0. , 0. ],
[-0. , -0.01381106, 0. , 0. ],
[ 0. , 0. , 0.01402211, 0. ],
[ 0. , 0. , 0. , 0.01386636]]), array([[0. , 0. , 0.08916432, 0. ],
[0. , 0. , 0. , 0.08817396],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.03105695, 0. , -0. , 0. ],
[ 0. , 0.03140578, 0. , 0. ],
[-0. , 0. , -0.03093308, 0. ],
[ 0. , 0. , 0. , 0.03128052]]), array([[ 0.000434 , -0. , -0. , 0. ],
[-0. , -0.00043887, 0. , 0. ],
[-0. , 0. , -0.00043574, 0. ],
[ 0. , 0. , 0. , 0.00044063]]), array([[-0. , 0. , -0.00277078, 0. ],
[ 0. , 0. , 0. , 0.0028019 ],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.14847052, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.14787835],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00207477, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.00208308],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.01324596],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[9, 8]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.99832359, 0. , 0. , 0. ],
[0. , 0.98836868, 0. , 0. ],
[0. , 0. , 0.99167227, 0. ],
[0. , 0. , 0. , 0.98178368]]), array([[-0.04982097, -0. , 0. , 0. ],
[-0. , -0.04932417, 0. , 0. ],
[ 0. , 0. , 0.05015512, 0. ],
[ 0. , 0. , 0. , 0.04965499]]), array([[0. , 0. , 0.11490298, 0. ],
[0. , 0. , 0. , 0.11375721],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.02942304, 0. , -0. , 0. ],
[ 0. , 0.02971939, 0. , 0. ],
[-0. , 0. , -0.02922701, 0. ],
[ 0. , 0. , 0. , 0.02952138]]), array([[ 0.00146835, -0. , -0. , 0. ],
[-0. , -0.00148313, 0. , 0. ],
[-0. , 0. , -0.00147819, 0. ],
[ 0. , 0. , 0. , 0.00149308]]), array([[-0. , 0. , -0.00338647, 0. ],
[ 0. , 0. , 0. , 0.00342058],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.14056967, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.13963312],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00701508, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.00706213],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.016179],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[9, 10]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99978957, 0. ],
[0. , 0.99270616]]), array([[-0.02051362, 0. ],
[ 0. , 0.02065999]]), array([[0. , 0.1187756],
[0. , 0. ]])]}, {'name': 'id', 'qubits': [1]}], [{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99978957, 0. ],
[0. , 0.99270616]]), array([[-0.02051362, 0. ],
[ 0. , 0.02065999]]), array([[0. , 0.1187756],
[0. , 0. ]])]}, {'name': 'z', 'qubits': [1]}], [{'name': 'kraus', 'qubits': [0], 'params': [array([[0.99978957, 0. ],
[0. , 0.99270616]]), array([[-0.02051362, 0. ],
[ 0. , 0.02065999]]), array([[0. , 0.1187756],
[0. , 0. ]])]}, {'name': 'reset', 'qubits': [1]}]], 'probabilities': [0.9854782357229671, 0.0033112803547615008, 0.01121048392227142], 'gate_qubits': [[11, 3]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.99867347, 0. , 0. , 0. ],
[0. , 0.99203254, 0. , 0. ],
[0. , 0. , 0.9926386 , 0. ],
[0. , 0. , 0. , 0.98603781]]), array([[-0.04749794, -0. , 0. , 0. ],
[-0. , -0.04718209, 0. , 0. ],
[ 0. , 0. , 0.04778671, 0. ],
[ 0. , 0. , 0. , 0.04746894]]), array([[0. , 0. , 0.10949786, 0. ],
[0. , 0. , 0. , 0.10876973],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.01985858, 0. , -0. , 0. ],
[ 0. , 0.01999152, 0. , 0. ],
[-0. , 0. , -0.01973858, 0. ],
[ 0. , 0. , 0. , 0.01987072]]), array([[ 0.00094449, -0. , -0. , 0. ],
[-0. , -0.00095082, 0. , 0. ],
[-0. , 0. , -0.00095024, 0. ],
[ 0. , 0. , 0. , 0.0009566 ]]), array([[-0. , 0. , -0.00217736, 0. ],
[ 0. , 0. , 0. , 0.00219194],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.11495579, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.11426112],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00546742, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.00550066],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.01260413],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[11, 10]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.99949892, 0. , 0. , 0. ],
[0. , 0.99361835, 0. , 0. ],
[0. , 0. , 0.9947017 , 0. ],
[0. , 0. , 0. , 0.98884936]]), array([[-0.02552915, -0. , 0. , 0. ],
[-0. , -0.02537894, 0. , 0. ],
[ 0. , 0. , 0.02565227, 0. ],
[ 0. , 0. , 0. , 0.02550134]]), array([[0. , 0. , 0.09777688, 0. ],
[0. , 0. , 0. , 0.09720161],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.01870667, 0. , -0. , 0. ],
[ 0. , 0.01881739, 0. , 0. ],
[-0. , 0. , -0.01861689, 0. ],
[ 0. , 0. , 0. , 0.01872707]]), array([[ 0.0004778 , -0. , -0. , 0. ],
[-0. , -0.00048063, 0. , 0. ],
[-0. , 0. , -0.00048011, 0. ],
[ 0. , 0. , 0. , 0.00048295]]), array([[-0. , 0. , -0.00183 , 0. ],
[ 0. , 0. , 0. , 0.00184083],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.10824283, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.10772331],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00276473, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.00277807],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.01058895],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[11, 12]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.99821794, 0. , 0. , 0. ],
[0. , 0.98172808, 0. , 0. ],
[0. , 0. , 0.98037949, 0. ],
[0. , 0. , 0. , 0.96418431]]), array([[-0.03698126, -0. , 0. , 0. ],
[-0. , -0.03637036, 0. , 0. ],
[ 0. , 0. , 0.03765415, 0. ],
[ 0. , 0. , 0. , 0.03703213]]), array([[0. , 0. , 0.18773623, 0. ],
[0. , 0. , 0. , 0.18463496],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.0468009 , 0. , -0. , 0. ],
[ 0. , 0.04758701, 0. , 0. ],
[-0. , 0. , -0.04596456, 0. ],
[ 0. , 0. , 0. , 0.04673661]]), array([[ 0.00173385, -0. , -0. , 0. ],
[-0. , -0.00176297, 0. , 0. ],
[-0. , 0. , -0.00176539, 0. ],
[ 0. , 0. , 0. , 0.00179505]]), array([[-0. , 0. , -0.00880191, 0. ],
[ 0. , 0. , 0. , 0.00894975],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.180485 , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.17725968],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00668648, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.00680814],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.03394406],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[12, 2]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.99872925, 0. , 0. , 0. ],
[0. , 0.96492642, 0. , 0. ],
[0. , 0. , 0.98628657, 0. ],
[0. , 0. , 0. , 0.95290487]]), array([[-0.03480416, -0. , 0. , 0. ],
[-0. , -0.03362618, 0. , 0. ],
[ 0. , 0. , 0.03524324, 0. ],
[ 0. , 0. , 0. , 0.0340504 ]]), array([[0. , 0. , 0.15706106, 0. ],
[0. , 0. , 0. , 0.1517452 ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.03642711, 0. , -0. , 0. ],
[ 0. , 0.03770321, 0. , 0. ],
[-0. , 0. , -0.03597328, 0. ],
[ 0. , 0. , 0. , 0.03723348]]), array([[ 0.00126943, -0. , -0. , 0. ],
[-0. , -0.0013139 , 0. , 0. ],
[-0. , 0. , -0.00128544, 0. ],
[ 0. , 0. , 0. , 0.00133047]]), array([[-0. , 0. , -0.00572856, 0. ],
[ 0. , 0. , 0. , 0.00592924],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.25745393, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.25424644],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00897187, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.00908505],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.04048744],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[13, 1]]}, {'type': 'qerror', 'operations': ['cx'], 'instructions': [[{'name': 'kraus', 'qubits': [0, 1], 'params': [array([[0.9992213 , 0. , 0. , 0. ],
[0. , 0.98070161, 0. , 0. ],
[0. , 0. , 0.99324583, 0. ],
[0. , 0. , 0. , 0.9748369 ]]), array([[-0.02845818, -0. , 0. , 0. ],
[-0. , -0.02793073, 0. , 0. ],
[ 0. , 0. , 0.02862938, 0. ],
[ 0. , 0. , 0. , 0.02809876]]), array([[0. , 0. , 0.10906946, 0. ],
[0. , 0. , 0. , 0.10704795],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]]), array([[-0.02731897, 0. , -0. , 0. ],
[ 0. , 0.02783486, 0. , 0. ],
[-0. , 0. , -0.0271556 , 0. ],
[ 0. , 0. , 0. , 0.02766841]]), array([[ 0.00077805, -0. , -0. , 0. ],
[-0. , -0.00079275, 0. , 0. ],
[-0. , 0. , -0.00078273, 0. ],
[ 0. , 0. , 0. , 0.00079752]]), array([[-0. , 0. , -0.00298199, 0. ],
[ 0. , 0. , 0. , 0.0030383 ],
[-0. , 0. , -0. , 0. ],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0.19141342, 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0.19026874],
[0. , 0. , 0. , 0. ]]), array([[-0. , -0.00545152, 0. , 0. ],
[-0. , -0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.00548432],
[ 0. , 0. , 0. , 0. ]]), array([[0. , 0. , 0. , 0.02089363],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ],
[0. , 0. , 0. , 0. ]])]}]], 'probabilities': [1], 'gate_qubits': [[13, 12]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.9566, 0.043399999999999994], [0.043399999999999994, 0.9566]], 'gate_qubits': [[0]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.9598, 0.040200000000000014], [0.040200000000000014, 0.9598]], 'gate_qubits': [[1]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.9609000000000001, 0.03909999999999991], [0.03909999999999991, 0.9609000000000001]], 'gate_qubits': [[2]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.7697, 0.23029999999999995], [0.23029999999999995, 0.7697]], 'gate_qubits': [[3]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.9346, 0.06540000000000001], [0.06540000000000001, 0.9346]], 'gate_qubits': [[4]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.953, 0.04700000000000004], [0.04700000000000004, 0.953]], 'gate_qubits': [[5]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.9674, 0.03259999999999996], [0.03259999999999996, 0.9674]], 'gate_qubits': [[6]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.8124, 0.1876], [0.1876, 0.8124]], 'gate_qubits': [[7]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.9593, 0.04069999999999996], [0.04069999999999996, 0.9593]], 'gate_qubits': [[8]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.9719, 0.028100000000000014], [0.028100000000000014, 0.9719]], 'gate_qubits': [[9]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.9402, 0.059799999999999964], [0.059799999999999964, 0.9402]], 'gate_qubits': [[10]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.6636, 0.33640000000000003], [0.33640000000000003, 0.6636]], 'gate_qubits': [[11]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.9145000000000001, 0.08549999999999991], [0.08549999999999991, 0.9145000000000001]], 'gate_qubits': [[12]]}, {'type': 'roerror', 'operations': ['measure'], 'probabilities': [[0.9521, 0.047900000000000054], [0.047900000000000054, 0.9521]], 'gate_qubits': [[13]]}], 'x90_gates': []}, 'parameters': {}, 'external_id': 'sim_product_state_2_copies_20190610T110047Z'}}
| 1,210.847007
| 500,450
| 0.49241
| 84,612
| 546,092
| 3.159918
| 0.013651
| 0.106034
| 0.033931
| 0.080586
| 0.962912
| 0.955728
| 0.953498
| 0.943613
| 0.943224
| 0.941728
| 0
| 0.179017
| 0.129204
| 546,092
| 451
| 500,451
| 1,210.847007
| 0.383227
| 0.001047
| 0
| 0.233945
| 0
| 0.288991
| 0.530093
| 0.101872
| 0
| 0
| 0.001386
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
97b3b82c33d49eae96285d84d8e75545c921e813
| 298,347
|
py
|
Python
|
services/waas/src/oci_cli_waas/generated/waas_cli.py
|
honzajavorek/oci-cli
|
6ea058afba323c6b3b70e98212ffaebb0d31985e
|
[
"Apache-2.0"
] | null | null | null |
services/waas/src/oci_cli_waas/generated/waas_cli.py
|
honzajavorek/oci-cli
|
6ea058afba323c6b3b70e98212ffaebb0d31985e
|
[
"Apache-2.0"
] | null | null | null |
services/waas/src/oci_cli_waas/generated/waas_cli.py
|
honzajavorek/oci-cli
|
6ea058afba323c6b3b70e98212ffaebb0d31985e
|
[
"Apache-2.0"
] | null | null | null |
# coding: utf-8
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
from __future__ import print_function
import click
import oci # noqa: F401
import six # noqa: F401
import sys # noqa: F401
from oci_cli.cli_root import cli
from oci_cli import cli_constants # noqa: F401
from oci_cli import cli_util
from oci_cli import json_skeleton_utils
from oci_cli import custom_types # noqa: F401
from oci_cli.aliasing import CommandGroupWithAlias
@cli.command(cli_util.override('waas_root_group.command_name', 'waas'), cls=CommandGroupWithAlias, help=cli_util.override('waas_root_group.help', """OCI Web Application Acceleration and Security Services"""), short_help=cli_util.override('waas_root_group.short_help', """Web Application Acceleration and Security Services API"""))
@cli_util.help_option_group
def waas_root_group():
pass
@click.command(cli_util.override('waas_policy_group.command_name', 'waas-policy'), cls=CommandGroupWithAlias, help="""The details of a Web Application Acceleration and Security (WAAS) policy. A policy describes how the WAAS service should operate for the configured web application.
**Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.""")
@cli_util.help_option_group
def waas_policy_group():
pass
@click.command(cli_util.override('access_rule_group.command_name', 'access-rule'), cls=CommandGroupWithAlias, help="""A content access rule. An access rule specifies an action to take if a set of criteria is matched by a request.""")
@cli_util.help_option_group
def access_rule_group():
pass
@click.command(cli_util.override('good_bot_group.command_name', 'good-bot'), cls=CommandGroupWithAlias, help="""The good bot settings. Good bots provides a list of bots which are managed by known providers.""")
@cli_util.help_option_group
def good_bot_group():
pass
@click.command(cli_util.override('threat_feed_group.command_name', 'threat-feed'), cls=CommandGroupWithAlias, help="""The settings of the threat intelligence feed. You can block requests from IP addresses based on their reputations with various commercial and open source threat feeds.""")
@cli_util.help_option_group
def threat_feed_group():
pass
@click.command(cli_util.override('waf_traffic_datum_group.command_name', 'waf-traffic-datum'), cls=CommandGroupWithAlias, help="""A time series of traffic data for the Web Application Firewall configured for a policy.""")
@cli_util.help_option_group
def waf_traffic_datum_group():
pass
@click.command(cli_util.override('certificate_group.command_name', 'certificate'), cls=CommandGroupWithAlias, help="""The details of the SSL certificate. **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.""")
@cli_util.help_option_group
def certificate_group():
pass
@click.command(cli_util.override('edge_subnet_group.command_name', 'edge-subnet'), cls=CommandGroupWithAlias, help="""The details about an edge node subnet.""")
@cli_util.help_option_group
def edge_subnet_group():
pass
@click.command(cli_util.override('recommendation_group.command_name', 'recommendation'), cls=CommandGroupWithAlias, help="""A recommended protection rule for a web application. This recommendation can be accepted to apply it to the Web Application Firewall configuration for this policy.
Use the `POST /waasPolicies/{waasPolicyId}/actions/acceptWafConfigRecommendations` method to accept recommended protection rules.""")
@cli_util.help_option_group
def recommendation_group():
pass
@click.command(cli_util.override('waas_policy_custom_protection_rule_group.command_name', 'waas-policy-custom-protection-rule'), cls=CommandGroupWithAlias, help="""Summary information about a Custom Protection rule.""")
@cli_util.help_option_group
def waas_policy_custom_protection_rule_group():
pass
@click.command(cli_util.override('js_challenge_group.command_name', 'js-challenge'), cls=CommandGroupWithAlias, help="""The JavaScript challenge settings. Javascript Challenge is the function to filter abnormal or malicious bots and allow access to real clients.""")
@cli_util.help_option_group
def js_challenge_group():
pass
@click.command(cli_util.override('work_request_group.command_name', 'work-request'), cls=CommandGroupWithAlias, help="""Many of the API requests you use to create and configure WAAS policies do not take effect immediately. In these cases, the request spawns an asynchronous work flow to fulfill the request. `WorkRequest` objects provide visibility for in-progress work flows. For more information about work requests, see [Viewing the State of a Work Request].""")
@cli_util.help_option_group
def work_request_group():
pass
@click.command(cli_util.override('custom_protection_rule_group.command_name', 'custom-protection-rule'), cls=CommandGroupWithAlias, help="""The details of a Custom Protection rule.""")
@cli_util.help_option_group
def custom_protection_rule_group():
pass
@click.command(cli_util.override('address_rate_limiting_group.command_name', 'address-rate-limiting'), cls=CommandGroupWithAlias, help="""The IP rate limiting configuration. Defines the amount of allowed requests from a unique IP address and the resulting block response code when that threshold is exceeded.""")
@cli_util.help_option_group
def address_rate_limiting_group():
pass
@click.command(cli_util.override('captcha_group.command_name', 'captcha'), cls=CommandGroupWithAlias, help="""The settings of the CAPTCHA challenge. If a specific URL should be accessed only by a human, a CAPTCHA challenge can be placed at the URL to protect the web application from bots.
*Warning:* Oracle recommends that you avoid using any confidential information when you supply string values using the API.""")
@cli_util.help_option_group
def captcha_group():
pass
@click.command(cli_util.override('custom_protection_rule_setting_group.command_name', 'custom-protection-rule-setting'), cls=CommandGroupWithAlias, help="""The OCID and action of a Custom Protection rule.""")
@cli_util.help_option_group
def custom_protection_rule_setting_group():
pass
@click.command(cli_util.override('waf_blocked_request_group.command_name', 'waf-blocked-request'), cls=CommandGroupWithAlias, help="""""")
@cli_util.help_option_group
def waf_blocked_request_group():
pass
@click.command(cli_util.override('policy_config_group.command_name', 'policy-config'), cls=CommandGroupWithAlias, help="""The configuration details for the WAAS policy.""")
@cli_util.help_option_group
def policy_config_group():
pass
@click.command(cli_util.override('waf_request_group.command_name', 'waf-request'), cls=CommandGroupWithAlias, help="""A time series of request counts handled by the Web Application Firewall, including blocked requests.""")
@cli_util.help_option_group
def waf_request_group():
pass
@click.command(cli_util.override('protection_rule_group.command_name', 'protection-rule'), cls=CommandGroupWithAlias, help="""The protection rule settings. Protection rules can allow, block, or trigger an alert if a request meets the parameters of an applied rule.""")
@cli_util.help_option_group
def protection_rule_group():
pass
@click.command(cli_util.override('whitelist_group.command_name', 'whitelist'), cls=CommandGroupWithAlias, help="""An array of IP addresses that bypass the Web Application Firewall. Supports both single IP addresses or subnet masks (CIDR notation).""")
@cli_util.help_option_group
def whitelist_group():
pass
@click.command(cli_util.override('purge_cache_group.command_name', 'purge-cache'), cls=CommandGroupWithAlias, help="""The list of resources for cache purge. If a resources property is not provided, the purge targets all resources in a policy.""")
@cli_util.help_option_group
def purge_cache_group():
pass
@click.command(cli_util.override('human_interaction_challenge_group.command_name', 'human-interaction-challenge'), cls=CommandGroupWithAlias, help="""The human interaction challenge settings. The human interaction challenge checks various event listeners in the user's browser to determine if there is a human user making a request.""")
@cli_util.help_option_group
def human_interaction_challenge_group():
pass
@click.command(cli_util.override('device_fingerprint_challenge_group.command_name', 'device-fingerprint-challenge'), cls=CommandGroupWithAlias, help="""The device fingerprint challenge settings. The device fingerprint challenge generates hashed signatures of both virtual and real browsers to identify and block malicious bots.""")
@cli_util.help_option_group
def device_fingerprint_challenge_group():
pass
@click.command(cli_util.override('address_list_group.command_name', 'address-list'), cls=CommandGroupWithAlias, help="""The details of the address list.""")
@cli_util.help_option_group
def address_list_group():
pass
@click.command(cli_util.override('waf_log_group.command_name', 'waf-log'), cls=CommandGroupWithAlias, help="""A list of Web Application Firewall log entries. Each entry is a JSON object, including a timestamp property and other fields varying based on log type. Logs record what rules and countermeasures are triggered by requests and are used as a basis to move request handling into block mode. For more information about WAF logs, see [WAF Logs].""")
@cli_util.help_option_group
def waf_log_group():
pass
@click.command(cli_util.override('caching_rule_group.command_name', 'caching-rule'), cls=CommandGroupWithAlias, help="""""")
@cli_util.help_option_group
def caching_rule_group():
pass
@click.command(cli_util.override('protection_settings_group.command_name', 'protection-settings'), cls=CommandGroupWithAlias, help="""The settings used for protection rules.""")
@cli_util.help_option_group
def protection_settings_group():
pass
@click.command(cli_util.override('waf_config_group.command_name', 'waf-config'), cls=CommandGroupWithAlias, help="""The Web Application Firewall configuration for the WAAS policy.""")
@cli_util.help_option_group
def waf_config_group():
pass
waas_root_group.add_command(waas_policy_group)
waas_root_group.add_command(access_rule_group)
waas_root_group.add_command(good_bot_group)
waas_root_group.add_command(threat_feed_group)
waas_root_group.add_command(waf_traffic_datum_group)
waas_root_group.add_command(certificate_group)
waas_root_group.add_command(edge_subnet_group)
waas_root_group.add_command(recommendation_group)
waas_root_group.add_command(waas_policy_custom_protection_rule_group)
waas_root_group.add_command(js_challenge_group)
waas_root_group.add_command(work_request_group)
waas_root_group.add_command(custom_protection_rule_group)
waas_root_group.add_command(address_rate_limiting_group)
waas_root_group.add_command(captcha_group)
waas_root_group.add_command(custom_protection_rule_setting_group)
waas_root_group.add_command(waf_blocked_request_group)
waas_root_group.add_command(policy_config_group)
waas_root_group.add_command(waf_request_group)
waas_root_group.add_command(protection_rule_group)
waas_root_group.add_command(whitelist_group)
waas_root_group.add_command(purge_cache_group)
waas_root_group.add_command(human_interaction_challenge_group)
waas_root_group.add_command(device_fingerprint_challenge_group)
waas_root_group.add_command(address_list_group)
waas_root_group.add_command(waf_log_group)
waas_root_group.add_command(caching_rule_group)
waas_root_group.add_command(protection_settings_group)
waas_root_group.add_command(waf_config_group)
@recommendation_group.command(name=cli_util.override('accept_recommendations.command_name', 'accept'), help=u"""Accepts a list of recommended Web Application Firewall protection rules. Web Application Firewall protection rule recommendations are sets of rules generated by observed traffic patterns through the Web Application Firewall and are meant to optimize the Web Application Firewall's security profile. Only the rules specified in the request body will be updated; all other rules will remain unchanged.
Use the `GET /waasPolicies/{waasPolicyId}/wafConfig/recommendations` method to view a list of recommended Web Application Firewall protection rules. For more information, see [WAF Protection Rules].""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--protection-rule-keys', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'protection-rule-keys': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'protection-rule-keys': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.wrap_exceptions
def accept_recommendations(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, protection_rule_keys, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.accept_recommendations(
waas_policy_id=waas_policy_id,
protection_rule_keys=cli_util.parse_json_parameter("protection_rule_keys", protection_rule_keys),
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@work_request_group.command(name=cli_util.override('cancel_work_request.command_name', 'cancel'), help=u"""Cancels a specified work request.""")
@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the work request. This number is generated when work request is created.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.confirm_delete_option
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def cancel_work_request(ctx, from_json, work_request_id, if_match):
if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0:
raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.cancel_work_request(
work_request_id=work_request_id,
**kwargs
)
cli_util.render_response(result, ctx)
@address_list_group.command(name=cli_util.override('change_address_list_compartment.command_name', 'change-compartment'), help=u"""Moves address list into a different compartment. When provided, If-Match is checked against ETag values of the address list.""")
@cli_util.option('--address-list-id', required=True, help=u"""The [OCID] of the address list. This number is generated when the address list is added to the compartment.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment into which the resource should be moved.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def change_address_list_compartment(ctx, from_json, address_list_id, compartment_id, if_match):
if isinstance(address_list_id, six.string_types) and len(address_list_id.strip()) == 0:
raise click.UsageError('Parameter --address-list-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['compartmentId'] = compartment_id
client = cli_util.build_client('waas', ctx)
result = client.change_address_list_compartment(
address_list_id=address_list_id,
change_address_list_compartment_details=details,
**kwargs
)
cli_util.render_response(result, ctx)
@certificate_group.command(name=cli_util.override('change_certificate_compartment.command_name', 'change-compartment'), help=u"""Moves certificate into a different compartment. When provided, If-Match is checked against ETag values of the certificate.""")
@cli_util.option('--certificate-id', required=True, help=u"""The [OCID] of the SSL certificate used in the WAAS policy. This number is generated when the certificate is added to the policy.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment into which the resource should be moved.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def change_certificate_compartment(ctx, from_json, certificate_id, compartment_id, if_match):
if isinstance(certificate_id, six.string_types) and len(certificate_id.strip()) == 0:
raise click.UsageError('Parameter --certificate-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['compartmentId'] = compartment_id
client = cli_util.build_client('waas', ctx)
result = client.change_certificate_compartment(
certificate_id=certificate_id,
change_certificate_compartment_details=details,
**kwargs
)
cli_util.render_response(result, ctx)
@custom_protection_rule_group.command(name=cli_util.override('change_custom_protection_rule_compartment.command_name', 'change-compartment'), help=u"""Moves Custom Protection rule into a different compartment. When provided, If-Match is checked against ETag values of the Custom Protection rule.""")
@cli_util.option('--custom-protection-rule-id', required=True, help=u"""The [OCID] of the Custom Protection rule. This number is generated when the Custom Protection rule is added to the compartment.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment into which the resource should be moved.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def change_custom_protection_rule_compartment(ctx, from_json, custom_protection_rule_id, compartment_id, if_match):
if isinstance(custom_protection_rule_id, six.string_types) and len(custom_protection_rule_id.strip()) == 0:
raise click.UsageError('Parameter --custom-protection-rule-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['compartmentId'] = compartment_id
client = cli_util.build_client('waas', ctx)
result = client.change_custom_protection_rule_compartment(
custom_protection_rule_id=custom_protection_rule_id,
change_custom_protection_rule_compartment_details=details,
**kwargs
)
cli_util.render_response(result, ctx)
@waas_policy_group.command(name=cli_util.override('change_waas_policy_compartment.command_name', 'change-compartment'), help=u"""Moves WAAS policy into a different compartment. When provided, If-Match is checked against ETag values of the WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment into which the resource should be moved.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def change_waas_policy_compartment(ctx, from_json, waas_policy_id, compartment_id, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['compartmentId'] = compartment_id
client = cli_util.build_client('waas', ctx)
result = client.change_waas_policy_compartment(
waas_policy_id=waas_policy_id,
change_waas_policy_compartment_details=details,
**kwargs
)
cli_util.render_response(result, ctx)
@address_list_group.command(name=cli_util.override('create_address_list.command_name', 'create'), help=u"""Creates an address list in set compartment and allows it to be used in a WAAS policy. For more information, see [WAF Settings].""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to create the address list.""")
@cli_util.option('--display-name', required=True, help=u"""A unique user-friendly name for the address list.""")
@cli_util.option('--addresses', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of IP addresses or CIDR notations.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource to see if it has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'addresses': {'module': 'waas', 'class': 'list[string]'}, 'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'addresses': {'module': 'waas', 'class': 'list[string]'}, 'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'waas', 'class': 'AddressList'})
@cli_util.wrap_exceptions
def create_address_list(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, addresses, freeform_tags, defined_tags):
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['compartmentId'] = compartment_id
details['displayName'] = display_name
details['addresses'] = cli_util.parse_json_parameter("addresses", addresses)
if freeform_tags is not None:
details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
if defined_tags is not None:
details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
client = cli_util.build_client('waas', ctx)
result = client.create_address_list(
create_address_list_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_address_list') and callable(getattr(client, 'get_address_list')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_address_list(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@certificate_group.command(name=cli_util.override('create_certificate.command_name', 'create'), help=u"""Allows an SSL certificate to be added to a WAAS policy. The Web Application Firewall terminates SSL connections to inspect requests in runtime, and then re-encrypts requests before sending them to the origin for fulfillment.
For more information, see [WAF Settings].""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to create the SSL certificate.""")
@cli_util.option('--certificate-data', required=True, help=u"""The data of the SSL certificate.
**Note:** Many SSL certificate providers require an intermediate certificate chain to ensure a trusted status. If your SSL certificate requires an intermediate certificate chain, please append the intermediate certificate key in the `certificateData` field after the leaf certificate issued by the SSL certificate provider. If you are unsure if your certificate requires an intermediate certificate chain, see your certificate provider's documentation.
The example below shows an intermediate certificate appended to a leaf certificate.""")
@cli_util.option('--private-key-data', required=True, help=u"""The private key of the SSL certificate.""")
@cli_util.option('--display-name', help=u"""A user-friendly name for the SSL certificate. The name can be changed and does not need to be unique.""")
@cli_util.option('--is-trust-verification-disabled', type=click.BOOL, help=u"""Set to `true` if the SSL certificate is self-signed.""")
@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource to see if it has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'waas', 'class': 'Certificate'})
@cli_util.wrap_exceptions
def create_certificate(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, certificate_data, private_key_data, display_name, is_trust_verification_disabled, freeform_tags, defined_tags):
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['compartmentId'] = compartment_id
details['certificateData'] = certificate_data
details['privateKeyData'] = private_key_data
if display_name is not None:
details['displayName'] = display_name
if is_trust_verification_disabled is not None:
details['isTrustVerificationDisabled'] = is_trust_verification_disabled
if freeform_tags is not None:
details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
if defined_tags is not None:
details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
client = cli_util.build_client('waas', ctx)
result = client.create_certificate(
create_certificate_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_certificate') and callable(getattr(client, 'get_certificate')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_certificate(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@custom_protection_rule_group.command(name=cli_util.override('create_custom_protection_rule.command_name', 'create'), help=u"""Creates a new Custom Protection rule in the specified compartment.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to create the Custom Protection rule.""")
@cli_util.option('--display-name', required=True, help=u"""A user-friendly name for the Custom Protection rule.""")
@cli_util.option('--template', required=True, help=u"""The template text of the Custom Protection rule. The syntax is based on ModSecurity Rule Language. Additionaly it needs to include two variables / placeholders which will be replaced during publishing.
- **{{mode}}** - rule action, defined by user in UI, like `OFF`, `DETECT` or `BLOCK`.
- **{{id_1}}** - unique rule ID which identifies a `SecRule`, generated by the system. Multiple IDs can be used by increasing the number of the variable for every `SecRule` defined in the template.
*Example usage:* ``` SecRule REQUEST_COOKIES \"regex matching SQL injection - part 1/2\" \\ \"phase:2, \\ msg:'Detects chained SQL injection attempts 1/2.', \\ id: {{id_1}}, \\ ctl:ruleEngine={{mode}}, \\ deny\" SecRule REQUEST_COOKIES \"regex matching SQL injection - part 2/2\" \\ \"phase:2, \\ msg:'Detects chained SQL injection attempts 2/2.', \\ id: {{id_2}}, \\ ctl:ruleEngine={{mode}}, \\ deny\" ``` The example contains two `SecRules` each having distinct regex expression to match `Cookie` header value during second input analysis phase. The disruptive `deny` action takes effect only when `{{mode}}` is set to `BLOCK`. The message is logged either when `{{mode}}` is set to `DETECT` or `BLOCK`.
For more information about ModSecurity's open source WAF rules, see [Mod Security's documentation].""")
@cli_util.option('--description', help=u"""A description for the Custom Protection rule.""")
@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource to see if it has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'waas', 'class': 'CustomProtectionRule'})
@cli_util.wrap_exceptions
def create_custom_protection_rule(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, display_name, template, description, freeform_tags, defined_tags):
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['compartmentId'] = compartment_id
details['displayName'] = display_name
details['template'] = template
if description is not None:
details['description'] = description
if freeform_tags is not None:
details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
if defined_tags is not None:
details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
client = cli_util.build_client('waas', ctx)
result = client.create_custom_protection_rule(
create_custom_protection_rule_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_custom_protection_rule') and callable(getattr(client, 'get_custom_protection_rule')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_custom_protection_rule(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@waas_policy_group.command(name=cli_util.override('create_waas_policy.command_name', 'create'), help=u"""Creates a new Web Application Acceleration and Security (WAAS) policy in the specified compartment. A WAAS policy must be established before creating Web Application Firewall (WAF) rules. To use WAF rules, your web application's origin servers must defined in the `WaasPolicy` schema.
A domain name must be specified when creating a WAAS policy. The domain name should be different from the origins specified in your `WaasPolicy`. Once domain name is entered and stored, it is unchangeable.
Use the record data returned in the `cname` field of the `WaasPolicy` object to create a CNAME record in your DNS configuration that will direct your domain's traffic through the WAF.
For the purposes of access control, you must provide the OCID of the compartment where you want the service to reside. For information about access control and compartments, see [Overview of the IAM Service].
You must specify a display name and domain for the WAAS policy. The display name does not have to be unique and can be changed. The domain name should be different from every origin specified in `WaasPolicy`.
All Oracle Cloud Infrastructure resources, including WAAS policies, receive a unique, Oracle-assigned ID called an Oracle Cloud Identifier (OCID). When a resource is created, you can find its OCID in the response. You can also retrieve a resource's OCID by using a list API operation for that resource type, or by viewing the resource in the Console. Fore more information, see [Resource Identifiers].
**Note:** After sending the POST request, the new object's state will temporarily be `CREATING`. Ensure that the resource's state has changed to `ACTIVE` before use.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment in which to create the WAAS policy.""")
@cli_util.option('--domain', required=True, help=u"""The web application domain that the WAAS policy protects.""")
@cli_util.option('--display-name', help=u"""A user-friendly name for the WAAS policy. The name can be changed and does not need to be unique.""")
@cli_util.option('--additional-domains', type=custom_types.CLI_COMPLEX_TYPE, help=u"""An array of additional domains for the specified web application.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--origins', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A map of host to origin for the web application. The key should be a customer friendly name for the host, ex. primary, secondary, etc.
This option is a JSON dictionary of type dict(str, Origin). For documentation on Origin please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/Origin.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--origin-groups', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The map of origin groups and their keys used to associate origins to the wafConfig.
This option is a JSON dictionary of type dict(str, OriginGroup). For documentation on OriginGroup please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/OriginGroup.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--policy-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--waf-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'additional-domains': {'module': 'waas', 'class': 'list[string]'}, 'origins': {'module': 'waas', 'class': 'dict(str, Origin)'}, 'origin-groups': {'module': 'waas', 'class': 'dict(str, OriginGroup)'}, 'policy-config': {'module': 'waas', 'class': 'PolicyConfig'}, 'waf-config': {'module': 'waas', 'class': 'WafConfigDetails'}, 'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'additional-domains': {'module': 'waas', 'class': 'list[string]'}, 'origins': {'module': 'waas', 'class': 'dict(str, Origin)'}, 'origin-groups': {'module': 'waas', 'class': 'dict(str, OriginGroup)'}, 'policy-config': {'module': 'waas', 'class': 'PolicyConfig'}, 'waf-config': {'module': 'waas', 'class': 'WafConfigDetails'}, 'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}})
@cli_util.wrap_exceptions
def create_waas_policy(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, compartment_id, domain, display_name, additional_domains, origins, origin_groups, policy_config, waf_config, freeform_tags, defined_tags):
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['compartmentId'] = compartment_id
details['domain'] = domain
if display_name is not None:
details['displayName'] = display_name
if additional_domains is not None:
details['additionalDomains'] = cli_util.parse_json_parameter("additional_domains", additional_domains)
if origins is not None:
details['origins'] = cli_util.parse_json_parameter("origins", origins)
if origin_groups is not None:
details['originGroups'] = cli_util.parse_json_parameter("origin_groups", origin_groups)
if policy_config is not None:
details['policyConfig'] = cli_util.parse_json_parameter("policy_config", policy_config)
if waf_config is not None:
details['wafConfig'] = cli_util.parse_json_parameter("waf_config", waf_config)
if freeform_tags is not None:
details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
if defined_tags is not None:
details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
client = cli_util.build_client('waas', ctx)
result = client.create_waas_policy(
create_waas_policy_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@address_list_group.command(name=cli_util.override('delete_address_list.command_name', 'delete'), help=u"""Deletes the address list from the compartment if it is not used.""")
@cli_util.option('--address-list-id', required=True, help=u"""The [OCID] of the address list. This number is generated when the address list is added to the compartment.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.confirm_delete_option
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource to see if it has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def delete_address_list(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, address_list_id, if_match):
if isinstance(address_list_id, six.string_types) and len(address_list_id.strip()) == 0:
raise click.UsageError('Parameter --address-list-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.delete_address_list(
address_list_id=address_list_id,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_address_list') and callable(getattr(client, 'get_address_list')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
oci.wait_until(client, client.get_address_list(address_list_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs)
except oci.exceptions.ServiceError as e:
# We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the
# outcome of a delete operation it is possible that the resource is already gone and so the initial service call
# will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising
# the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument
# succeed_on_not_found=True to the waiter).
#
# Any non-404 should still result in the exception being thrown.
if e.status == 404:
pass
else:
raise
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@certificate_group.command(name=cli_util.override('delete_certificate.command_name', 'delete'), help=u"""Deletes an SSL certificate from the WAAS service.""")
@cli_util.option('--certificate-id', required=True, help=u"""The [OCID] of the SSL certificate used in the WAAS policy. This number is generated when the certificate is added to the policy.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.confirm_delete_option
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource to see if it has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def delete_certificate(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, certificate_id, if_match):
if isinstance(certificate_id, six.string_types) and len(certificate_id.strip()) == 0:
raise click.UsageError('Parameter --certificate-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.delete_certificate(
certificate_id=certificate_id,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_certificate') and callable(getattr(client, 'get_certificate')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
oci.wait_until(client, client.get_certificate(certificate_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs)
except oci.exceptions.ServiceError as e:
# We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the
# outcome of a delete operation it is possible that the resource is already gone and so the initial service call
# will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising
# the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument
# succeed_on_not_found=True to the waiter).
#
# Any non-404 should still result in the exception being thrown.
if e.status == 404:
pass
else:
raise
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@custom_protection_rule_group.command(name=cli_util.override('delete_custom_protection_rule.command_name', 'delete'), help=u"""Deletes a Custom Protection rule.""")
@cli_util.option('--custom-protection-rule-id', required=True, help=u"""The [OCID] of the Custom Protection rule. This number is generated when the Custom Protection rule is added to the compartment.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.confirm_delete_option
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource to see if it has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def delete_custom_protection_rule(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, custom_protection_rule_id, if_match):
if isinstance(custom_protection_rule_id, six.string_types) and len(custom_protection_rule_id.strip()) == 0:
raise click.UsageError('Parameter --custom-protection-rule-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.delete_custom_protection_rule(
custom_protection_rule_id=custom_protection_rule_id,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_custom_protection_rule') and callable(getattr(client, 'get_custom_protection_rule')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
oci.wait_until(client, client.get_custom_protection_rule(custom_protection_rule_id), 'lifecycle_state', wait_for_state, succeed_on_not_found=True, **wait_period_kwargs)
except oci.exceptions.ServiceError as e:
# We make an initial service call so we can pass the result to oci.wait_until(), however if we are waiting on the
# outcome of a delete operation it is possible that the resource is already gone and so the initial service call
# will result in an exception that reflects a HTTP 404. In this case, we can exit with success (rather than raising
# the exception) since this would have been the behaviour in the waiter anyway (as for delete we provide the argument
# succeed_on_not_found=True to the waiter).
#
# Any non-404 should still result in the exception being thrown.
if e.status == 404:
pass
else:
raise
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the resource entered the specified state. Please retrieve the resource to find its current state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@waas_policy_group.command(name=cli_util.override('delete_waas_policy.command_name', 'delete'), help=u"""Deletes a policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.confirm_delete_option
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def delete_waas_policy(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.delete_waas_policy(
waas_policy_id=waas_policy_id,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Please retrieve the work request to find its current state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@address_list_group.command(name=cli_util.override('get_address_list.command_name', 'get'), help=u"""Gets the details of an address list.""")
@cli_util.option('--address-list-id', required=True, help=u"""The [OCID] of the address list. This number is generated when the address list is added to the compartment.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'AddressList'})
@cli_util.wrap_exceptions
def get_address_list(ctx, from_json, address_list_id):
if isinstance(address_list_id, six.string_types) and len(address_list_id.strip()) == 0:
raise click.UsageError('Parameter --address-list-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_address_list(
address_list_id=address_list_id,
**kwargs
)
cli_util.render_response(result, ctx)
@certificate_group.command(name=cli_util.override('get_certificate.command_name', 'get'), help=u"""Gets the details of an SSL certificate.""")
@cli_util.option('--certificate-id', required=True, help=u"""The [OCID] of the SSL certificate used in the WAAS policy. This number is generated when the certificate is added to the policy.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'Certificate'})
@cli_util.wrap_exceptions
def get_certificate(ctx, from_json, certificate_id):
if isinstance(certificate_id, six.string_types) and len(certificate_id.strip()) == 0:
raise click.UsageError('Parameter --certificate-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_certificate(
certificate_id=certificate_id,
**kwargs
)
cli_util.render_response(result, ctx)
@custom_protection_rule_group.command(name=cli_util.override('get_custom_protection_rule.command_name', 'get'), help=u"""Gets the details of a Custom Protection rule.""")
@cli_util.option('--custom-protection-rule-id', required=True, help=u"""The [OCID] of the Custom Protection rule. This number is generated when the Custom Protection rule is added to the compartment.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'CustomProtectionRule'})
@cli_util.wrap_exceptions
def get_custom_protection_rule(ctx, from_json, custom_protection_rule_id):
if isinstance(custom_protection_rule_id, six.string_types) and len(custom_protection_rule_id.strip()) == 0:
raise click.UsageError('Parameter --custom-protection-rule-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_custom_protection_rule(
custom_protection_rule_id=custom_protection_rule_id,
**kwargs
)
cli_util.render_response(result, ctx)
@device_fingerprint_challenge_group.command(name=cli_util.override('get_device_fingerprint_challenge.command_name', 'get'), help=u"""Gets the device fingerprint challenge settings in the Web Application Firewall configuration for a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'DeviceFingerprintChallenge'})
@cli_util.wrap_exceptions
def get_device_fingerprint_challenge(ctx, from_json, waas_policy_id):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_device_fingerprint_challenge(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@human_interaction_challenge_group.command(name=cli_util.override('get_human_interaction_challenge.command_name', 'get'), help=u"""Gets the human interaction challenge settings in the Web Application Firewall configuration for a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'HumanInteractionChallenge'})
@cli_util.wrap_exceptions
def get_human_interaction_challenge(ctx, from_json, waas_policy_id):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_human_interaction_challenge(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@js_challenge_group.command(name=cli_util.override('get_js_challenge.command_name', 'get'), help=u"""Gets the JavaScript challenge settings in the Web Application Firewall configuration for a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'JsChallenge'})
@cli_util.wrap_exceptions
def get_js_challenge(ctx, from_json, waas_policy_id):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_js_challenge(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@policy_config_group.command(name=cli_util.override('get_policy_config.command_name', 'get'), help=u"""Gets the configuration of a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'PolicyConfig'})
@cli_util.wrap_exceptions
def get_policy_config(ctx, from_json, waas_policy_id):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_policy_config(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@protection_rule_group.command(name=cli_util.override('get_protection_rule.command_name', 'get'), help=u"""Gets the details of a protection rule in the Web Application Firewall configuration for a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--protection-rule-key', required=True, help=u"""The protection rule key.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'ProtectionRule'})
@cli_util.wrap_exceptions
def get_protection_rule(ctx, from_json, waas_policy_id, protection_rule_key):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
if isinstance(protection_rule_key, six.string_types) and len(protection_rule_key.strip()) == 0:
raise click.UsageError('Parameter --protection-rule-key cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_protection_rule(
waas_policy_id=waas_policy_id,
protection_rule_key=protection_rule_key,
**kwargs
)
cli_util.render_response(result, ctx)
@protection_settings_group.command(name=cli_util.override('get_protection_settings.command_name', 'get'), help=u"""Gets the protection settings in the Web Application Firewall configuration for a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'ProtectionSettings'})
@cli_util.wrap_exceptions
def get_protection_settings(ctx, from_json, waas_policy_id):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_protection_settings(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@waas_policy_group.command(name=cli_util.override('get_waas_policy.command_name', 'get'), help=u"""Gets the details of a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'WaasPolicy'})
@cli_util.wrap_exceptions
def get_waas_policy(ctx, from_json, waas_policy_id):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_waas_policy(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@address_rate_limiting_group.command(name=cli_util.override('get_waf_address_rate_limiting.command_name', 'get-waf'), help=u"""Gets the address rate limiting settings of the Web Application Firewall configuration for a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'AddressRateLimiting'})
@cli_util.wrap_exceptions
def get_waf_address_rate_limiting(ctx, from_json, waas_policy_id):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_waf_address_rate_limiting(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@waf_config_group.command(name=cli_util.override('get_waf_config.command_name', 'get'), help=u"""Gets the Web Application Firewall configuration details for a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'WafConfig'})
@cli_util.wrap_exceptions
def get_waf_config(ctx, from_json, waas_policy_id):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_waf_config(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@work_request_group.command(name=cli_util.override('get_work_request.command_name', 'get'), help=u"""Gets the details of a specified work request.""")
@cli_util.option('--work-request-id', required=True, help=u"""The [OCID] of the work request. This number is generated when work request is created.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'WorkRequest'})
@cli_util.wrap_exceptions
def get_work_request(ctx, from_json, work_request_id):
if isinstance(work_request_id, six.string_types) and len(work_request_id.strip()) == 0:
raise click.UsageError('Parameter --work-request-id cannot be whitespace or empty string')
kwargs = {}
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.get_work_request(
work_request_id=work_request_id,
**kwargs
)
cli_util.render_response(result, ctx)
@access_rule_group.command(name=cli_util.override('list_access_rules.command_name', 'list'), help=u"""Gets the currently configured access rules for the Web Application Firewall configuration of a specified WAAS policy. The order of the access rules is important. The rules will be checked in the order they are specified and the first matching rule will be used.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[AccessRule]'})
@cli_util.wrap_exceptions
def list_access_rules(ctx, from_json, all_pages, page_size, waas_policy_id, limit, page):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_access_rules,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_access_rules,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_access_rules(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@address_list_group.command(name=cli_util.override('list_address_lists.command_name', 'list'), help=u"""Gets a list of address lists that can be used in a WAAS policy.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment. This number is generated when the compartment is created.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["id", "name", "timeCreated"]), help=u"""The value by which address lists are sorted in a paginated 'List' call. If unspecified, defaults to `timeCreated`.""")
@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The value of the sorting direction of resources in a paginated 'List' call. If unspecified, defaults to `DESC`.""")
@cli_util.option('--id', multiple=True, help=u"""Filter address lists using a list of address lists OCIDs.""")
@cli_util.option('--name', multiple=True, help=u"""Filter address lists using a list of names.""")
@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), multiple=True, help=u"""Filter address lists using a list of lifecycle states.""")
@cli_util.option('--time-created-greater-than-or-equal-to', type=custom_types.CLI_DATETIME, help=u"""A filter that matches address lists created on or after the specified date-time.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--time-created-less-than', type=custom_types.CLI_DATETIME, help=u"""A filter that matches address lists created before the specified date-time.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({'id': {'module': 'waas', 'class': 'list[string]'}, 'name': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'id': {'module': 'waas', 'class': 'list[string]'}, 'name': {'module': 'waas', 'class': 'list[string]'}}, output_type={'module': 'waas', 'class': 'list[AddressListSummary]'})
@cli_util.wrap_exceptions
def list_address_lists(ctx, from_json, all_pages, page_size, compartment_id, limit, page, sort_by, sort_order, id, name, lifecycle_state, time_created_greater_than_or_equal_to, time_created_less_than):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
if sort_by is not None:
kwargs['sort_by'] = sort_by
if sort_order is not None:
kwargs['sort_order'] = sort_order
if id is not None and len(id) > 0:
kwargs['id'] = id
if name is not None and len(name) > 0:
kwargs['name'] = name
if lifecycle_state is not None and len(lifecycle_state) > 0:
kwargs['lifecycle_state'] = lifecycle_state
if time_created_greater_than_or_equal_to is not None:
kwargs['time_created_greater_than_or_equal_to'] = time_created_greater_than_or_equal_to
if time_created_less_than is not None:
kwargs['time_created_less_than'] = time_created_less_than
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_address_lists,
compartment_id=compartment_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_address_lists,
limit,
page_size,
compartment_id=compartment_id,
**kwargs
)
else:
result = client.list_address_lists(
compartment_id=compartment_id,
**kwargs
)
cli_util.render_response(result, ctx)
@caching_rule_group.command(name=cli_util.override('list_caching_rules.command_name', 'list'), help=u"""Gets the currently configured caching rules for the Web Application Firewall configuration of a specified WAAS policy. The order of the caching rules is important. The rules will be checked in the order they are specified and the first matching rule will be used.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[CachingRuleSummary]'})
@cli_util.wrap_exceptions
def list_caching_rules(ctx, from_json, all_pages, page_size, waas_policy_id, limit, page):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_caching_rules,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_caching_rules,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_caching_rules(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@captcha_group.command(name=cli_util.override('list_captchas.command_name', 'list'), help=u"""Gets the list of currently configured CAPTCHA challenges in the Web Application Firewall configuration of a WAAS policy.
The order of the CAPTCHA challenges is important. The URL for each CAPTCHA will be checked in the order they are created.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[Captcha]'})
@cli_util.wrap_exceptions
def list_captchas(ctx, from_json, all_pages, page_size, waas_policy_id, limit, page):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_captchas,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_captchas,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_captchas(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@certificate_group.command(name=cli_util.override('list_certificates.command_name', 'list'), help=u"""Gets a list of SSL certificates that can be used in a WAAS policy.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment. This number is generated when the compartment is created.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["id", "compartmentId", "displayName", "notValidAfter", "timeCreated"]), help=u"""The value by which certificate summaries are sorted in a paginated 'List' call. If unspecified, defaults to `timeCreated`.""")
@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The value of the sorting direction of resources in a paginated 'List' call. If unspecified, defaults to `DESC`.""")
@cli_util.option('--id', multiple=True, help=u"""Filter certificates using a list of certificates OCIDs.""")
@cli_util.option('--display-name', multiple=True, help=u"""Filter certificates using a list of display names.""")
@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), multiple=True, help=u"""Filter certificates using a list of lifecycle states.""")
@cli_util.option('--time-created-greater-than-or-equal-to', type=custom_types.CLI_DATETIME, help=u"""A filter that matches certificates created on or after the specified date-time.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--time-created-less-than', type=custom_types.CLI_DATETIME, help=u"""A filter that matches certificates created before the specified date-time.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({'id': {'module': 'waas', 'class': 'list[string]'}, 'display-name': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'id': {'module': 'waas', 'class': 'list[string]'}, 'display-name': {'module': 'waas', 'class': 'list[string]'}}, output_type={'module': 'waas', 'class': 'list[CertificateSummary]'})
@cli_util.wrap_exceptions
def list_certificates(ctx, from_json, all_pages, page_size, compartment_id, limit, page, sort_by, sort_order, id, display_name, lifecycle_state, time_created_greater_than_or_equal_to, time_created_less_than):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
if sort_by is not None:
kwargs['sort_by'] = sort_by
if sort_order is not None:
kwargs['sort_order'] = sort_order
if id is not None and len(id) > 0:
kwargs['id'] = id
if display_name is not None and len(display_name) > 0:
kwargs['display_name'] = display_name
if lifecycle_state is not None and len(lifecycle_state) > 0:
kwargs['lifecycle_state'] = lifecycle_state
if time_created_greater_than_or_equal_to is not None:
kwargs['time_created_greater_than_or_equal_to'] = time_created_greater_than_or_equal_to
if time_created_less_than is not None:
kwargs['time_created_less_than'] = time_created_less_than
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_certificates,
compartment_id=compartment_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_certificates,
limit,
page_size,
compartment_id=compartment_id,
**kwargs
)
else:
result = client.list_certificates(
compartment_id=compartment_id,
**kwargs
)
cli_util.render_response(result, ctx)
@custom_protection_rule_group.command(name=cli_util.override('list_custom_protection_rules.command_name', 'list'), help=u"""Gets a list of Custom Protection rules.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment. This number is generated when the compartment is created.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["id", "compartmentId", "displayName", "modSecurityRuleId", "timeCreated"]), help=u"""The value by which Custom Protection rules are sorted in a paginated 'List' call. If unspecified, defaults to `timeCreated`.""")
@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The value of the sorting direction of resources in a paginated 'List' call. If unspecified, defaults to `DESC`.""")
@cli_util.option('--id', multiple=True, help=u"""Filter Custom Protection rules using a list of Custom Protection rules OCIDs.""")
@cli_util.option('--display-name', multiple=True, help=u"""Filter Custom Protection rules using a list of display names.""")
@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), multiple=True, help=u"""Filter Custom Protection rules using a list of lifecycle states.""")
@cli_util.option('--time-created-greater-than-or-equal-to', type=custom_types.CLI_DATETIME, help=u"""A filter that matches Custom Protection rules created on or after the specified date-time.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--time-created-less-than', type=custom_types.CLI_DATETIME, help=u"""A filter that matches Custom Protection rules created before the specified date-time.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({'id': {'module': 'waas', 'class': 'list[string]'}, 'display-name': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'id': {'module': 'waas', 'class': 'list[string]'}, 'display-name': {'module': 'waas', 'class': 'list[string]'}}, output_type={'module': 'waas', 'class': 'list[CustomProtectionRuleSummary]'})
@cli_util.wrap_exceptions
def list_custom_protection_rules(ctx, from_json, all_pages, page_size, compartment_id, limit, page, sort_by, sort_order, id, display_name, lifecycle_state, time_created_greater_than_or_equal_to, time_created_less_than):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
if sort_by is not None:
kwargs['sort_by'] = sort_by
if sort_order is not None:
kwargs['sort_order'] = sort_order
if id is not None and len(id) > 0:
kwargs['id'] = id
if display_name is not None and len(display_name) > 0:
kwargs['display_name'] = display_name
if lifecycle_state is not None and len(lifecycle_state) > 0:
kwargs['lifecycle_state'] = lifecycle_state
if time_created_greater_than_or_equal_to is not None:
kwargs['time_created_greater_than_or_equal_to'] = time_created_greater_than_or_equal_to
if time_created_less_than is not None:
kwargs['time_created_less_than'] = time_created_less_than
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_custom_protection_rules,
compartment_id=compartment_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_custom_protection_rules,
limit,
page_size,
compartment_id=compartment_id,
**kwargs
)
else:
result = client.list_custom_protection_rules(
compartment_id=compartment_id,
**kwargs
)
cli_util.render_response(result, ctx)
@edge_subnet_group.command(name=cli_util.override('list_edge_subnets.command_name', 'list'), help=u"""Return the list of the tenant's edge node subnets. Use these CIDR blocks to restrict incoming traffic to your origin. These subnets are owned by OCI and forward traffic to customer origins. They are not associated with specific regions or compartments.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["cidr", "region", "timeModified"]), help=u"""The value by which edge node subnets are sorted in a paginated 'List' call. If unspecified, defaults to `timeModified`.""")
@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The value of the sorting direction of resources in a paginated 'List' call. If unspecified, defaults to `DESC`.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[EdgeSubnet]'})
@cli_util.wrap_exceptions
def list_edge_subnets(ctx, from_json, all_pages, page_size, limit, page, sort_by, sort_order):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
if sort_by is not None:
kwargs['sort_by'] = sort_by
if sort_order is not None:
kwargs['sort_order'] = sort_order
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_edge_subnets,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_edge_subnets,
limit,
page_size,
**kwargs
)
else:
result = client.list_edge_subnets(
**kwargs
)
cli_util.render_response(result, ctx)
@good_bot_group.command(name=cli_util.override('list_good_bots.command_name', 'list'), help=u"""Gets the list of good bots defined in the Web Application Firewall configuration for a WAAS policy.
The list is sorted by `key`, in ascending order.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[GoodBot]'})
@cli_util.wrap_exceptions
def list_good_bots(ctx, from_json, all_pages, page_size, waas_policy_id, limit, page):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_good_bots,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_good_bots,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_good_bots(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@protection_rule_group.command(name=cli_util.override('list_protection_rules.command_name', 'list'), help=u"""Gets the list of available protection rules for a WAAS policy. Use the `GetWafConfig` operation to view a list of currently configured protection rules for the Web Application Firewall, or use the `ListRecommendations` operation to get a list of recommended protection rules for the Web Application Firewall. The list is sorted by `key`, in ascending order.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--mod-security-rule-id', multiple=True, help=u"""Filter rules using a list of ModSecurity rule IDs.""")
@cli_util.option('--action', type=custom_types.CliCaseInsensitiveChoice(["OFF", "DETECT", "BLOCK"]), multiple=True, help=u"""Filter rules using a list of actions.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({'mod-security-rule-id': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'mod-security-rule-id': {'module': 'waas', 'class': 'list[string]'}}, output_type={'module': 'waas', 'class': 'list[ProtectionRule]'})
@cli_util.wrap_exceptions
def list_protection_rules(ctx, from_json, all_pages, page_size, waas_policy_id, limit, page, mod_security_rule_id, action):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
if mod_security_rule_id is not None and len(mod_security_rule_id) > 0:
kwargs['mod_security_rule_id'] = mod_security_rule_id
if action is not None and len(action) > 0:
kwargs['action'] = action
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_protection_rules,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_protection_rules,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_protection_rules(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@recommendation_group.command(name=cli_util.override('list_recommendations.command_name', 'list'), help=u"""Gets the list of recommended Web Application Firewall protection rules.
Use the `POST /waasPolicies/{waasPolicyId}/actions/acceptWafConfigRecommendations` method to accept recommended Web Application Firewall protection rules. For more information, see [WAF Protection Rules]. The list is sorted by `key`, in ascending order.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--recommended-action', type=custom_types.CliCaseInsensitiveChoice(["DETECT", "BLOCK"]), help=u"""A filter that matches recommended protection rules based on the selected action. If unspecified, rules with any action type are returned.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[Recommendation]'})
@cli_util.wrap_exceptions
def list_recommendations(ctx, from_json, all_pages, page_size, waas_policy_id, recommended_action, limit, page):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if recommended_action is not None:
kwargs['recommended_action'] = recommended_action
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_recommendations,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_recommendations,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_recommendations(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@threat_feed_group.command(name=cli_util.override('list_threat_feeds.command_name', 'list'), help=u"""Gets the list of available web application threat intelligence feeds and the actions set for each feed. The list is sorted by `key`, in ascending order.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[ThreatFeed]'})
@cli_util.wrap_exceptions
def list_threat_feeds(ctx, from_json, all_pages, page_size, waas_policy_id, limit, page):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_threat_feeds,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_threat_feeds,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_threat_feeds(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@waas_policy_group.command(name=cli_util.override('list_waas_policies.command_name', 'list'), help=u"""Gets a list of WAAS policies.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment. This number is generated when the compartment is created.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["id", "displayName", "timeCreated"]), help=u"""The value by which policies are sorted in a paginated 'List' call. If unspecified, defaults to `timeCreated`.""")
@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The value of the sorting direction of resources in a paginated 'List' call. If unspecified, defaults to `DESC`.""")
@cli_util.option('--id', multiple=True, help=u"""Filter policies using a list of policy OCIDs.""")
@cli_util.option('--display-name', multiple=True, help=u"""Filter policies using a list of display names.""")
@cli_util.option('--lifecycle-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), multiple=True, help=u"""Filter policies using a list of lifecycle states.""")
@cli_util.option('--time-created-greater-than-or-equal-to', type=custom_types.CLI_DATETIME, help=u"""A filter that matches policies created on or after the specified date and time.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--time-created-less-than', type=custom_types.CLI_DATETIME, help=u"""A filter that matches policies created before the specified date-time.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({'id': {'module': 'waas', 'class': 'list[string]'}, 'display-name': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'id': {'module': 'waas', 'class': 'list[string]'}, 'display-name': {'module': 'waas', 'class': 'list[string]'}}, output_type={'module': 'waas', 'class': 'list[WaasPolicySummary]'})
@cli_util.wrap_exceptions
def list_waas_policies(ctx, from_json, all_pages, page_size, compartment_id, limit, page, sort_by, sort_order, id, display_name, lifecycle_state, time_created_greater_than_or_equal_to, time_created_less_than):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
if sort_by is not None:
kwargs['sort_by'] = sort_by
if sort_order is not None:
kwargs['sort_order'] = sort_order
if id is not None and len(id) > 0:
kwargs['id'] = id
if display_name is not None and len(display_name) > 0:
kwargs['display_name'] = display_name
if lifecycle_state is not None and len(lifecycle_state) > 0:
kwargs['lifecycle_state'] = lifecycle_state
if time_created_greater_than_or_equal_to is not None:
kwargs['time_created_greater_than_or_equal_to'] = time_created_greater_than_or_equal_to
if time_created_less_than is not None:
kwargs['time_created_less_than'] = time_created_less_than
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_waas_policies,
compartment_id=compartment_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_waas_policies,
limit,
page_size,
compartment_id=compartment_id,
**kwargs
)
else:
result = client.list_waas_policies(
compartment_id=compartment_id,
**kwargs
)
cli_util.render_response(result, ctx)
@waas_policy_custom_protection_rule_group.command(name=cli_util.override('list_waas_policy_custom_protection_rules.command_name', 'list'), help=u"""Gets the list of currently configured custom protection rules for a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--mod-security-rule-id', multiple=True, help=u"""Filter rules using a list of ModSecurity rule IDs.""")
@cli_util.option('--action', type=custom_types.CliCaseInsensitiveChoice(["DETECT", "BLOCK"]), multiple=True, help=u"""Filter rules using a list of actions.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({'mod-security-rule-id': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'mod-security-rule-id': {'module': 'waas', 'class': 'list[string]'}}, output_type={'module': 'waas', 'class': 'list[WaasPolicyCustomProtectionRuleSummary]'})
@cli_util.wrap_exceptions
def list_waas_policy_custom_protection_rules(ctx, from_json, all_pages, page_size, waas_policy_id, limit, page, mod_security_rule_id, action):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
if mod_security_rule_id is not None and len(mod_security_rule_id) > 0:
kwargs['mod_security_rule_id'] = mod_security_rule_id
if action is not None and len(action) > 0:
kwargs['action'] = action
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_waas_policy_custom_protection_rules,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_waas_policy_custom_protection_rules,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_waas_policy_custom_protection_rules(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@waf_blocked_request_group.command(name=cli_util.override('list_waf_blocked_requests.command_name', 'list'), help=u"""Gets the number of blocked requests by a Web Application Firewall feature in five minute blocks, sorted by `timeObserved` in ascending order (starting from oldest data).""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--time-observed-greater-than-or-equal-to', type=custom_types.CLI_DATETIME, help=u"""A filter that limits returned events to those occurring on or after a date and time, specified in RFC 3339 format. If unspecified, defaults to 30 minutes before receipt of the request.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--time-observed-less-than', type=custom_types.CLI_DATETIME, help=u"""A filter that limits returned events to those occurring before a date and time, specified in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--waf-feature', type=custom_types.CliCaseInsensitiveChoice(["PROTECTION_RULES", "JS_CHALLENGE", "ACCESS_RULES", "THREAT_FEEDS", "HUMAN_INTERACTION_CHALLENGE", "DEVICE_FINGERPRINT_CHALLENGE", "CAPTCHA", "ADDRESS_RATE_LIMITING"]), multiple=True, help=u"""Filter stats by the Web Application Firewall feature that triggered the block action. If unspecified, data for all WAF features will be returned.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[WafBlockedRequest]'})
@cli_util.wrap_exceptions
def list_waf_blocked_requests(ctx, from_json, all_pages, page_size, waas_policy_id, time_observed_greater_than_or_equal_to, time_observed_less_than, limit, page, waf_feature):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if time_observed_greater_than_or_equal_to is not None:
kwargs['time_observed_greater_than_or_equal_to'] = time_observed_greater_than_or_equal_to
if time_observed_less_than is not None:
kwargs['time_observed_less_than'] = time_observed_less_than
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
if waf_feature is not None and len(waf_feature) > 0:
kwargs['waf_feature'] = waf_feature
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_waf_blocked_requests,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_waf_blocked_requests,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_waf_blocked_requests(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@waf_log_group.command(name=cli_util.override('list_waf_logs.command_name', 'list'), help=u"""Gets structured Web Application Firewall event logs for a WAAS policy. Sorted by the `timeObserved` in ascending order (starting from the oldest recorded event).""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `20`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--time-observed-greater-than-or-equal-to', type=custom_types.CLI_DATETIME, help=u"""A filter that matches log entries where the observed event occurred on or after a date and time specified in RFC 3339 format. If unspecified, defaults to two hours before receipt of the request.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--time-observed-less-than', type=custom_types.CLI_DATETIME, help=u"""A filter that matches log entries where the observed event occurred before a date and time, specified in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--text-contains', help=u"""A full text search for logs.""")
@cli_util.option('--access-rule-key', multiple=True, help=u"""Filters logs by access rule key.""")
@cli_util.option('--action', type=custom_types.CliCaseInsensitiveChoice(["BLOCK", "DETECT", "BYPASS", "LOG", "REDIRECTED"]), multiple=True, help=u"""Filters logs by Web Application Firewall action.""")
@cli_util.option('--client-address', multiple=True, help=u"""Filters logs by client IP address.""")
@cli_util.option('--country-code', multiple=True, help=u"""Filters logs by country code. Country codes are in ISO 3166-1 alpha-2 format. For a list of codes, see [ISO's website].""")
@cli_util.option('--country-name', multiple=True, help=u"""Filter logs by country name.""")
@cli_util.option('--fingerprint', multiple=True, help=u"""Filter logs by device fingerprint.""")
@cli_util.option('--http-method', type=custom_types.CliCaseInsensitiveChoice(["OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT"]), multiple=True, help=u"""Filter logs by HTTP method.""")
@cli_util.option('--incident-key', multiple=True, help=u"""Filter logs by incident key.""")
@cli_util.option('--log-type', type=custom_types.CliCaseInsensitiveChoice(["ACCESS", "PROTECTION_RULES", "JS_CHALLENGE", "CAPTCHA", "ACCESS_RULES", "THREAT_FEEDS", "HUMAN_INTERACTION_CHALLENGE", "DEVICE_FINGERPRINT_CHALLENGE", "ADDRESS_RATE_LIMITING"]), multiple=True, help=u"""Filter by log type.""")
@cli_util.option('--origin-address', multiple=True, help=u"""Filter by origin IP address.""")
@cli_util.option('--referrer', multiple=True, help=u"""Filter by referrer.""")
@cli_util.option('--request-url', multiple=True, help=u"""Filter by request URL.""")
@cli_util.option('--response-code', multiple=True, help=u"""Filter by response code.""")
@cli_util.option('--threat-feed-key', multiple=True, help=u"""Filter by threat feed key.""")
@cli_util.option('--user-agent', multiple=True, help=u"""Filter by user agent.""")
@cli_util.option('--protection-rule-key', multiple=True, help=u"""Filter by protection rule key.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({'access-rule-key': {'module': 'waas', 'class': 'list[string]'}, 'client-address': {'module': 'waas', 'class': 'list[string]'}, 'country-code': {'module': 'waas', 'class': 'list[string]'}, 'country-name': {'module': 'waas', 'class': 'list[string]'}, 'fingerprint': {'module': 'waas', 'class': 'list[string]'}, 'incident-key': {'module': 'waas', 'class': 'list[string]'}, 'origin-address': {'module': 'waas', 'class': 'list[string]'}, 'referrer': {'module': 'waas', 'class': 'list[string]'}, 'request-url': {'module': 'waas', 'class': 'list[string]'}, 'response-code': {'module': 'waas', 'class': 'list[integer]'}, 'threat-feed-key': {'module': 'waas', 'class': 'list[string]'}, 'user-agent': {'module': 'waas', 'class': 'list[string]'}, 'protection-rule-key': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'access-rule-key': {'module': 'waas', 'class': 'list[string]'}, 'client-address': {'module': 'waas', 'class': 'list[string]'}, 'country-code': {'module': 'waas', 'class': 'list[string]'}, 'country-name': {'module': 'waas', 'class': 'list[string]'}, 'fingerprint': {'module': 'waas', 'class': 'list[string]'}, 'incident-key': {'module': 'waas', 'class': 'list[string]'}, 'origin-address': {'module': 'waas', 'class': 'list[string]'}, 'referrer': {'module': 'waas', 'class': 'list[string]'}, 'request-url': {'module': 'waas', 'class': 'list[string]'}, 'response-code': {'module': 'waas', 'class': 'list[integer]'}, 'threat-feed-key': {'module': 'waas', 'class': 'list[string]'}, 'user-agent': {'module': 'waas', 'class': 'list[string]'}, 'protection-rule-key': {'module': 'waas', 'class': 'list[string]'}}, output_type={'module': 'waas', 'class': 'list[WafLog]'})
@cli_util.wrap_exceptions
def list_waf_logs(ctx, from_json, all_pages, page_size, waas_policy_id, limit, page, time_observed_greater_than_or_equal_to, time_observed_less_than, text_contains, access_rule_key, action, client_address, country_code, country_name, fingerprint, http_method, incident_key, log_type, origin_address, referrer, request_url, response_code, threat_feed_key, user_agent, protection_rule_key):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
if time_observed_greater_than_or_equal_to is not None:
kwargs['time_observed_greater_than_or_equal_to'] = time_observed_greater_than_or_equal_to
if time_observed_less_than is not None:
kwargs['time_observed_less_than'] = time_observed_less_than
if text_contains is not None:
kwargs['text_contains'] = text_contains
if access_rule_key is not None and len(access_rule_key) > 0:
kwargs['access_rule_key'] = access_rule_key
if action is not None and len(action) > 0:
kwargs['action'] = action
if client_address is not None and len(client_address) > 0:
kwargs['client_address'] = client_address
if country_code is not None and len(country_code) > 0:
kwargs['country_code'] = country_code
if country_name is not None and len(country_name) > 0:
kwargs['country_name'] = country_name
if fingerprint is not None and len(fingerprint) > 0:
kwargs['fingerprint'] = fingerprint
if http_method is not None and len(http_method) > 0:
kwargs['http_method'] = http_method
if incident_key is not None and len(incident_key) > 0:
kwargs['incident_key'] = incident_key
if log_type is not None and len(log_type) > 0:
kwargs['log_type'] = log_type
if origin_address is not None and len(origin_address) > 0:
kwargs['origin_address'] = origin_address
if referrer is not None and len(referrer) > 0:
kwargs['referrer'] = referrer
if request_url is not None and len(request_url) > 0:
kwargs['request_url'] = request_url
if response_code is not None and len(response_code) > 0:
kwargs['response_code'] = response_code
if threat_feed_key is not None and len(threat_feed_key) > 0:
kwargs['threat_feed_key'] = threat_feed_key
if user_agent is not None and len(user_agent) > 0:
kwargs['user_agent'] = user_agent
if protection_rule_key is not None and len(protection_rule_key) > 0:
kwargs['protection_rule_key'] = protection_rule_key
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_waf_logs,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_waf_logs,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_waf_logs(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@waf_request_group.command(name=cli_util.override('list_waf_requests.command_name', 'list'), help=u"""Gets the number of requests managed by a Web Application Firewall over a specified period of time, including blocked requests. Sorted by `timeObserved` in ascending order (starting from oldest requests).""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--time-observed-greater-than-or-equal-to', type=custom_types.CLI_DATETIME, help=u"""A filter that limits returned events to those occurring on or after a date and time, specified in RFC 3339 format. If unspecified, defaults to 30 minutes before receipt of the request.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--time-observed-less-than', type=custom_types.CLI_DATETIME, help=u"""A filter that limits returned events to those occurring before a date and time, specified in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[WafRequest]'})
@cli_util.wrap_exceptions
def list_waf_requests(ctx, from_json, all_pages, page_size, waas_policy_id, time_observed_greater_than_or_equal_to, time_observed_less_than, limit, page):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if time_observed_greater_than_or_equal_to is not None:
kwargs['time_observed_greater_than_or_equal_to'] = time_observed_greater_than_or_equal_to
if time_observed_less_than is not None:
kwargs['time_observed_less_than'] = time_observed_less_than
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_waf_requests,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_waf_requests,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_waf_requests(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@waf_traffic_datum_group.command(name=cli_util.override('list_waf_traffic.command_name', 'list-waf-traffic'), help=u"""Gets the Web Application Firewall traffic data for a WAAS policy. Sorted by `timeObserved` in ascending order (starting from oldest data).""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--time-observed-greater-than-or-equal-to', type=custom_types.CLI_DATETIME, help=u"""A filter that limits returned events to those occurring on or after a date and time, specified in RFC 3339 format. If unspecified, defaults to 30 minutes before receipt of the request.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--time-observed-less-than', type=custom_types.CLI_DATETIME, help=u"""A filter that limits returned events to those occurring before a date and time, specified in RFC 3339 format.""" + custom_types.CLI_DATETIME.VALID_DATETIME_CLI_HELP_MESSAGE)
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[WafTrafficDatum]'})
@cli_util.wrap_exceptions
def list_waf_traffic(ctx, from_json, all_pages, page_size, waas_policy_id, time_observed_greater_than_or_equal_to, time_observed_less_than, limit, page):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if time_observed_greater_than_or_equal_to is not None:
kwargs['time_observed_greater_than_or_equal_to'] = time_observed_greater_than_or_equal_to
if time_observed_less_than is not None:
kwargs['time_observed_less_than'] = time_observed_less_than
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_waf_traffic,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_waf_traffic,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_waf_traffic(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@whitelist_group.command(name=cli_util.override('list_whitelists.command_name', 'list'), help=u"""Gets the list of whitelists defined in the Web Application Firewall configuration for a WAAS policy.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[Whitelist]'})
@cli_util.wrap_exceptions
def list_whitelists(ctx, from_json, all_pages, page_size, waas_policy_id, limit, page):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_whitelists,
waas_policy_id=waas_policy_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_whitelists,
limit,
page_size,
waas_policy_id=waas_policy_id,
**kwargs
)
else:
result = client.list_whitelists(
waas_policy_id=waas_policy_id,
**kwargs
)
cli_util.render_response(result, ctx)
@work_request_group.command(name=cli_util.override('list_work_requests.command_name', 'list'), help=u"""Gets a list of subnets (CIDR notation) from which the WAAS EDGE may make requests. The subnets are owned by OCI and forward traffic to your origins. Allow traffic from these subnets to your origins. They are not associated with specific regions or compartments.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the policy.""")
@cli_util.option('--compartment-id', required=True, help=u"""The [OCID] of the compartment. This number is generated when the compartment is created.""")
@cli_util.option('--limit', type=click.INT, help=u"""The maximum number of items to return in a paginated call. In unspecified, defaults to `10`.""")
@cli_util.option('--page', help=u"""The value of the `opc-next-page` response header from the previous paginated call.""")
@cli_util.option('--sort-by', type=custom_types.CliCaseInsensitiveChoice(["id", "status", "timeAccepted", "timeStarted", "timeFinished", "operationType"]), help=u"""The value by which work requests are sorted in a paginated 'List' call. If unspecified, defaults to `timeAccepted`.""")
@cli_util.option('--sort-order', type=custom_types.CliCaseInsensitiveChoice(["ASC", "DESC"]), help=u"""The value of the sorting direction of resources in a paginated 'List' call. If unspecified, defaults to `DESC`.""")
@cli_util.option('--all', 'all_pages', is_flag=True, help="""Fetches all pages of results. If you provide this option, then you cannot provide the --limit option.""")
@cli_util.option('--page-size', type=click.INT, help="""When fetching results, the number of results to fetch per call. Only valid when used with --all or --limit, and ignored otherwise.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={}, output_type={'module': 'waas', 'class': 'list[WorkRequestSummary]'})
@cli_util.wrap_exceptions
def list_work_requests(ctx, from_json, all_pages, page_size, waas_policy_id, compartment_id, limit, page, sort_by, sort_order):
if all_pages and limit:
raise click.UsageError('If you provide the --all option you cannot provide the --limit option')
kwargs = {}
if limit is not None:
kwargs['limit'] = limit
if page is not None:
kwargs['page'] = page
if sort_by is not None:
kwargs['sort_by'] = sort_by
if sort_order is not None:
kwargs['sort_order'] = sort_order
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
if all_pages:
if page_size:
kwargs['limit'] = page_size
result = cli_util.list_call_get_all_results(
client.list_work_requests,
waas_policy_id=waas_policy_id,
compartment_id=compartment_id,
**kwargs
)
elif limit is not None:
result = cli_util.list_call_get_up_to_limit(
client.list_work_requests,
limit,
page_size,
waas_policy_id=waas_policy_id,
compartment_id=compartment_id,
**kwargs
)
else:
result = client.list_work_requests(
waas_policy_id=waas_policy_id,
compartment_id=compartment_id,
**kwargs
)
cli_util.render_response(result, ctx)
@purge_cache_group.command(name=cli_util.override('purge_cache.command_name', 'purge-cache'), help=u"""Accepts a list of resources that will get it's cache purged. If resources property is not passed, then the entire cache for Web Application will be purged.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--resources', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A resource to purge, identified by either a hostless absolute path starting with a single slash (e.g., \"/path/to/resource\") or by a relative path in which the first component will be interpreted as a domain protected by this policy (e.g., \"example.com/path/to/resource\").""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'resources': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'resources': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.wrap_exceptions
def purge_cache(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, if_match, resources):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
if resources is not None:
details['resources'] = cli_util.parse_json_parameter("resources", resources)
client = cli_util.build_client('waas', ctx)
result = client.purge_cache(
waas_policy_id=waas_policy_id,
purge_cache=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@access_rule_group.command(name=cli_util.override('update_access_rules.command_name', 'update'), help=u"""Updates the list of access rules in the Web Application Firewall configuration for a specified WAAS policy. Access rules allow explicit actions to be defined and executed for requests that meet various conditions. A rule action can be set to allow, detect, or block requests. The detect setting allows the request to pass through the Web Application Firewall and is tagged with a `DETECT` flag in the Web Application Firewall's log.
This operation can create, delete, update, and/or reorder access rules depending on the structure of the request body.
Access rules can be updated by changing the properties of the access rule object with the rule's key specified in the key field. Access rules can be reordered by changing the order of the access rules in the list when updating.
Access rules can be created by adding a new access rule object to the list without a `key` property specified. A `key` will be generated for the new access rule upon update.
Any existing access rules that are not specified with a `key` in the list of access rules will be deleted upon update.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--access-rules', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'access-rules': {'module': 'waas', 'class': 'list[AccessRule]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'access-rules': {'module': 'waas', 'class': 'list[AccessRule]'}})
@cli_util.wrap_exceptions
def update_access_rules(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, access_rules, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.update_access_rules(
waas_policy_id=waas_policy_id,
access_rules=cli_util.parse_json_parameter("access_rules", access_rules),
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@certificate_group.command(name=cli_util.override('update_address_list.command_name', 'update-address-list'), help=u"""Updates the details of an address list. Only the fields specified in the request body will be updated; all other properties will remain unchanged.""")
@cli_util.option('--address-list-id', required=True, help=u"""The [OCID] of the address list. This number is generated when the address list is added to the compartment.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--display-name', help=u"""A unique user-friendly name for the address list.""")
@cli_util.option('--addresses', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of IP addresses or CIDR notations.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource to see if it has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'addresses': {'module': 'waas', 'class': 'list[string]'}, 'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'addresses': {'module': 'waas', 'class': 'list[string]'}, 'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'waas', 'class': 'AddressList'})
@cli_util.wrap_exceptions
def update_address_list(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, address_list_id, if_match, display_name, addresses, freeform_tags, defined_tags):
if isinstance(address_list_id, six.string_types) and len(address_list_id.strip()) == 0:
raise click.UsageError('Parameter --address-list-id cannot be whitespace or empty string')
if not force:
if addresses or freeform_tags or defined_tags:
if not click.confirm("WARNING: Updates to addresses and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"):
ctx.abort()
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
if display_name is not None:
details['displayName'] = display_name
if addresses is not None:
details['addresses'] = cli_util.parse_json_parameter("addresses", addresses)
if freeform_tags is not None:
details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
if defined_tags is not None:
details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
client = cli_util.build_client('waas', ctx)
result = client.update_address_list(
address_list_id=address_list_id,
update_address_list_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_address_list') and callable(getattr(client, 'get_address_list')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_address_list(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@caching_rule_group.command(name=cli_util.override('update_caching_rules.command_name', 'update'), help=u"""Updates the configuration for each specified caching rule. This operation can update or delete caching rules depending on the structure of the request body. Caching rules can be updated by changing the properties of the caching rule object with the rule's key specified in the key field. Any existing caching rules that are not specified with a key in the list of access rules will be deleted upon update.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--caching-rules-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'caching-rules-details': {'module': 'waas', 'class': 'list[CachingRule]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'caching-rules-details': {'module': 'waas', 'class': 'list[CachingRule]'}})
@cli_util.wrap_exceptions
def update_caching_rules(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, caching_rules_details, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.update_caching_rules(
waas_policy_id=waas_policy_id,
caching_rules_details=cli_util.parse_json_parameter("caching_rules_details", caching_rules_details),
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@captcha_group.command(name=cli_util.override('update_captchas.command_name', 'update'), help=u"""Updates the list of CAPTCHA challenges in the Web Application Firewall configuration for a WAAS policy. This operation can create, update, or delete CAPTCHAs depending on the structure of the request body. CAPTCHA challenges can be updated by changing the properties of the CAPTCHA object with the rule's key specified in the key field. CAPTCHA challenges can be reordered by changing the order of the CAPTCHA challenges in the list when updating.
CAPTCHA challenges can be created by adding a new access rule object to the list without a `key` property specified. A `key` will be generated for the new CAPTCHA challenges upon update.
Any existing CAPTCHA challenges that are not specified with a `key` in the list of CAPTCHA challenges will be deleted upon update.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--captchas', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of CAPTCHA details.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'captchas': {'module': 'waas', 'class': 'list[Captcha]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'captchas': {'module': 'waas', 'class': 'list[Captcha]'}})
@cli_util.wrap_exceptions
def update_captchas(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, captchas, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.update_captchas(
waas_policy_id=waas_policy_id,
captchas=cli_util.parse_json_parameter("captchas", captchas),
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@certificate_group.command(name=cli_util.override('update_certificate.command_name', 'update'), help=u"""It is not possible to update a certificate, only create and delete. Therefore, this operation can only update the display name, freeform tags, and defined tags of a certificate.""")
@cli_util.option('--certificate-id', required=True, help=u"""The [OCID] of the SSL certificate used in the WAAS policy. This number is generated when the certificate is added to the policy.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--display-name', help=u"""A user-friendly name for the SSL certificate. The name can be changed and does not need to be unique.""")
@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource to see if it has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'waas', 'class': 'Certificate'})
@cli_util.wrap_exceptions
def update_certificate(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, certificate_id, if_match, display_name, freeform_tags, defined_tags):
if isinstance(certificate_id, six.string_types) and len(certificate_id.strip()) == 0:
raise click.UsageError('Parameter --certificate-id cannot be whitespace or empty string')
if not force:
if freeform_tags or defined_tags:
if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"):
ctx.abort()
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
if display_name is not None:
details['displayName'] = display_name
if freeform_tags is not None:
details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
if defined_tags is not None:
details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
client = cli_util.build_client('waas', ctx)
result = client.update_certificate(
certificate_id=certificate_id,
update_certificate_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_certificate') and callable(getattr(client, 'get_certificate')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_certificate(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@custom_protection_rule_group.command(name=cli_util.override('update_custom_protection_rule.command_name', 'update'), help=u"""Updates the details of a Custom Protection rule. Only the fields specified in the request body will be updated; all other properties will remain unchanged.""")
@cli_util.option('--custom-protection-rule-id', required=True, help=u"""The [OCID] of the Custom Protection rule. This number is generated when the Custom Protection rule is added to the compartment.""")
@cli_util.option('--display-name', help=u"""A user-friendly name for the Custom Protection rule.""")
@cli_util.option('--description', help=u"""A description for the Custom Protection rule.""")
@cli_util.option('--template', help=u"""The template text of the Custom Protection rule. The syntax is based on ModSecurity Rule Language. Additionaly it needs to include two variables / placeholders which will be replaced during publishing.
- **{{mode}}** - rule action, defined by user in UI, like `OFF`, `DETECT` or `BLOCK`.
- **{{id_1}}** - unique rule ID which identifies a `SecRule`, generated by the system. Multiple IDs can be used by increasing the number of the variable for every `SecRule` defined in the template.
*Example usage:* ``` SecRule REQUEST_COOKIES \"regex matching SQL injection - part 1/2\" \\ \"phase:2, \\ msg:'Detects chained SQL injection attempts 1/2.', \\ id: {{id_1}}, \\ ctl:ruleEngine={{mode}}, \\ deny\" SecRule REQUEST_COOKIES \"regex matching SQL injection - part 2/2\" \\ \"phase:2, \\ msg:'Detects chained SQL injection attempts 2/2.', \\ id: {{id_2}}, \\ ctl:ruleEngine={{mode}}, \\ deny\" ``` The example contains two `SecRules` each having distinct regex expression to match `Cookie` header value during second input analysis phase. The disruptive `deny` action takes effect only when `{{mode}}` is set to `BLOCK`. The message is logged either when `{{mode}}` is set to `DETECT` or `BLOCK`.
For more information about ModSecurity's open source WAF rules, see [Mod Security's documentation].""")
@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["CREATING", "ACTIVE", "FAILED", "UPDATING", "DELETING", "DELETED"]), help="""This operation creates, modifies or deletes a resource that has a defined lifecycle state. Specify this option to perform the action and then wait until the resource reaches a given lifecycle state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the resource to reach the lifecycle state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the resource to see if it has reached the lifecycle state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}}, output_type={'module': 'waas', 'class': 'CustomProtectionRule'})
@cli_util.wrap_exceptions
def update_custom_protection_rule(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, custom_protection_rule_id, display_name, description, template, freeform_tags, defined_tags, if_match):
if isinstance(custom_protection_rule_id, six.string_types) and len(custom_protection_rule_id.strip()) == 0:
raise click.UsageError('Parameter --custom-protection-rule-id cannot be whitespace or empty string')
if not force:
if freeform_tags or defined_tags:
if not click.confirm("WARNING: Updates to freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"):
ctx.abort()
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
if display_name is not None:
details['displayName'] = display_name
if description is not None:
details['description'] = description
if template is not None:
details['template'] = template
if freeform_tags is not None:
details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
if defined_tags is not None:
details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
client = cli_util.build_client('waas', ctx)
result = client.update_custom_protection_rule(
custom_protection_rule_id=custom_protection_rule_id,
update_custom_protection_rule_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_custom_protection_rule') and callable(getattr(client, 'get_custom_protection_rule')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the resource has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_custom_protection_rule(result.data.id), 'lifecycle_state', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the resource entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for resource to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the resource to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@device_fingerprint_challenge_group.command(name=cli_util.override('update_device_fingerprint_challenge.command_name', 'update'), help=u"""Updates the Device Fingerprint Challenge (DFC) settings in the Web Application Firewall configuration for a policy. The DFC generates a hashed signature of both virtual and real browsers based on 50+ attributes. These proprietary signatures are then leveraged for real-time correlation to identify and block malicious bots.
The signature is based on a library of attributes detected via JavaScript listeners; the attributes include OS, screen resolution, fonts, UserAgent, IP address, etc. We are constantly making improvements and considering new libraries to include in our DFC build. We can also exclude attributes from the signature as needed.
DFC collects attributes to generate a hashed signature about a client \u2013 if a fingerprint is not possible, then it will result in a block or alert action. Actions can be enforced across multiple devices if they share they have the same fingerprint.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--is-enabled', required=True, type=click.BOOL, help=u"""Enables or disables the device fingerprint challenge Web Application Firewall feature.""")
@cli_util.option('--action', type=custom_types.CliCaseInsensitiveChoice(["DETECT", "BLOCK"]), help=u"""The action to take on requests from detected bots. If unspecified, defaults to `DETECT`.""")
@cli_util.option('--failure-threshold', type=click.INT, help=u"""The number of failed requests allowed before taking action. If unspecified, defaults to `10`.""")
@cli_util.option('--action-expiration-in-seconds', type=click.INT, help=u"""The number of seconds between challenges for the same IP address. If unspecified, defaults to `60`.""")
@cli_util.option('--failure-threshold-expiration-in-seconds', type=click.INT, help=u"""The number of seconds before the failure threshold resets. If unspecified, defaults to `60`.""")
@cli_util.option('--max-address-count', type=click.INT, help=u"""The maximum number of IP addresses permitted with the same device fingerprint. If unspecified, defaults to `20`.""")
@cli_util.option('--max-address-count-expiration-in-seconds', type=click.INT, help=u"""The number of seconds before the maximum addresses count resets. If unspecified, defaults to `60`.""")
@cli_util.option('--challenge-settings', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'challenge-settings': {'module': 'waas', 'class': 'BlockChallengeSettings'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'challenge-settings': {'module': 'waas', 'class': 'BlockChallengeSettings'}})
@cli_util.wrap_exceptions
def update_device_fingerprint_challenge(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, is_enabled, action, failure_threshold, action_expiration_in_seconds, failure_threshold_expiration_in_seconds, max_address_count, max_address_count_expiration_in_seconds, challenge_settings, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
if not force:
if challenge_settings:
if not click.confirm("WARNING: Updates to challenge-settings will replace any existing values. Are you sure you want to continue?"):
ctx.abort()
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['isEnabled'] = is_enabled
if action is not None:
details['action'] = action
if failure_threshold is not None:
details['failureThreshold'] = failure_threshold
if action_expiration_in_seconds is not None:
details['actionExpirationInSeconds'] = action_expiration_in_seconds
if failure_threshold_expiration_in_seconds is not None:
details['failureThresholdExpirationInSeconds'] = failure_threshold_expiration_in_seconds
if max_address_count is not None:
details['maxAddressCount'] = max_address_count
if max_address_count_expiration_in_seconds is not None:
details['maxAddressCountExpirationInSeconds'] = max_address_count_expiration_in_seconds
if challenge_settings is not None:
details['challengeSettings'] = cli_util.parse_json_parameter("challenge_settings", challenge_settings)
client = cli_util.build_client('waas', ctx)
result = client.update_device_fingerprint_challenge(
waas_policy_id=waas_policy_id,
update_device_fingerprint_challenge_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@good_bot_group.command(name=cli_util.override('update_good_bots.command_name', 'update'), help=u"""Updates the list of good bots in the Web Application Firewall configuration for a policy. Only the fields specified in the request body will be updated, all other configuration properties will remain unchanged.
Good bots allows you to manage access for bots from known providers, such as Google or Baidu. For more information about good bots, see [Bot Management].""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--good-bots', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'good-bots': {'module': 'waas', 'class': 'list[GoodBot]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'good-bots': {'module': 'waas', 'class': 'list[GoodBot]'}})
@cli_util.wrap_exceptions
def update_good_bots(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, good_bots, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.update_good_bots(
waas_policy_id=waas_policy_id,
good_bots=cli_util.parse_json_parameter("good_bots", good_bots),
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@human_interaction_challenge_group.command(name=cli_util.override('update_human_interaction_challenge.command_name', 'update'), help=u"""Updates the Human Interaction Challenge (HIC) settings in the Web Application Firewall configuration for a WAAS policy. HIC is a countermeasure that allows the proxy to check the user's browser for various behaviors that distinguish a human presence from a bot.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--is-enabled', required=True, type=click.BOOL, help=u"""Enables or disables the human interaction challenge Web Application Firewall feature.""")
@cli_util.option('--action', type=custom_types.CliCaseInsensitiveChoice(["DETECT", "BLOCK"]), help=u"""The action to take against requests from detected bots. If unspecified, defaults to `DETECT`.""")
@cli_util.option('--failure-threshold', type=click.INT, help=u"""The number of failed requests before taking action. If unspecified, defaults to `10`.""")
@cli_util.option('--action-expiration-in-seconds', type=click.INT, help=u"""The number of seconds between challenges for the same IP address. If unspecified, defaults to `60`.""")
@cli_util.option('--failure-threshold-expiration-in-seconds', type=click.INT, help=u"""The number of seconds before the failure threshold resets. If unspecified, defaults to `60`.""")
@cli_util.option('--interaction-threshold', type=click.INT, help=u"""The number of interactions required to pass the challenge. If unspecified, defaults to `3`.""")
@cli_util.option('--recording-period-in-seconds', type=click.INT, help=u"""The number of seconds to record the interactions from the user. If unspecified, defaults to `15`.""")
@cli_util.option('--set-http-header', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Adds an additional HTTP header to requests that fail the challenge before being passed to the origin. Only applicable when the `action` is set to `DETECT`.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--challenge-settings', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'set-http-header': {'module': 'waas', 'class': 'Header'}, 'challenge-settings': {'module': 'waas', 'class': 'BlockChallengeSettings'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'set-http-header': {'module': 'waas', 'class': 'Header'}, 'challenge-settings': {'module': 'waas', 'class': 'BlockChallengeSettings'}})
@cli_util.wrap_exceptions
def update_human_interaction_challenge(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, is_enabled, action, failure_threshold, action_expiration_in_seconds, failure_threshold_expiration_in_seconds, interaction_threshold, recording_period_in_seconds, set_http_header, challenge_settings, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
if not force:
if set_http_header or challenge_settings:
if not click.confirm("WARNING: Updates to set-http-header and challenge-settings will replace any existing values. Are you sure you want to continue?"):
ctx.abort()
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['isEnabled'] = is_enabled
if action is not None:
details['action'] = action
if failure_threshold is not None:
details['failureThreshold'] = failure_threshold
if action_expiration_in_seconds is not None:
details['actionExpirationInSeconds'] = action_expiration_in_seconds
if failure_threshold_expiration_in_seconds is not None:
details['failureThresholdExpirationInSeconds'] = failure_threshold_expiration_in_seconds
if interaction_threshold is not None:
details['interactionThreshold'] = interaction_threshold
if recording_period_in_seconds is not None:
details['recordingPeriodInSeconds'] = recording_period_in_seconds
if set_http_header is not None:
details['setHttpHeader'] = cli_util.parse_json_parameter("set_http_header", set_http_header)
if challenge_settings is not None:
details['challengeSettings'] = cli_util.parse_json_parameter("challenge_settings", challenge_settings)
client = cli_util.build_client('waas', ctx)
result = client.update_human_interaction_challenge(
waas_policy_id=waas_policy_id,
update_human_interaction_challenge_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@js_challenge_group.command(name=cli_util.override('update_js_challenge.command_name', 'update'), help=u"""Updates the JavaScript challenge settings in the Web Application Firewall configuration for a WAAS policy. JavaScript Challenge validates that the client can accept JavaScript with a binary decision. For more information, see [Bot Management].""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--is-enabled', required=True, type=click.BOOL, help=u"""Enables or disables the JavaScript challenge Web Application Firewall feature.""")
@cli_util.option('--action', type=custom_types.CliCaseInsensitiveChoice(["DETECT", "BLOCK"]), help=u"""The action to take against requests from detected bots. If unspecified, defaults to `DETECT`.""")
@cli_util.option('--failure-threshold', type=click.INT, help=u"""The number of failed requests before taking action. If unspecified, defaults to `10`.""")
@cli_util.option('--action-expiration-in-seconds', type=click.INT, help=u"""The number of seconds between challenges from the same IP address. If unspecified, defaults to `60`.""")
@cli_util.option('--set-http-header', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Adds an additional HTTP header to requests that fail the challenge before being passed to the origin. Only applicable when the `action` is set to `DETECT`.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--challenge-settings', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'set-http-header': {'module': 'waas', 'class': 'Header'}, 'challenge-settings': {'module': 'waas', 'class': 'BlockChallengeSettings'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'set-http-header': {'module': 'waas', 'class': 'Header'}, 'challenge-settings': {'module': 'waas', 'class': 'BlockChallengeSettings'}})
@cli_util.wrap_exceptions
def update_js_challenge(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, is_enabled, action, failure_threshold, action_expiration_in_seconds, set_http_header, challenge_settings, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
if not force:
if set_http_header or challenge_settings:
if not click.confirm("WARNING: Updates to set-http-header and challenge-settings will replace any existing values. Are you sure you want to continue?"):
ctx.abort()
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['isEnabled'] = is_enabled
if action is not None:
details['action'] = action
if failure_threshold is not None:
details['failureThreshold'] = failure_threshold
if action_expiration_in_seconds is not None:
details['actionExpirationInSeconds'] = action_expiration_in_seconds
if set_http_header is not None:
details['setHttpHeader'] = cli_util.parse_json_parameter("set_http_header", set_http_header)
if challenge_settings is not None:
details['challengeSettings'] = cli_util.parse_json_parameter("challenge_settings", challenge_settings)
client = cli_util.build_client('waas', ctx)
result = client.update_js_challenge(
waas_policy_id=waas_policy_id,
update_js_challenge_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@policy_config_group.command(name=cli_util.override('update_policy_config.command_name', 'update'), help=u"""Updates the configuration for a WAAS policy. Only the fields specified in the request body will be updated; all other properties will remain unchanged.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--certificate-id', help=u"""The OCID of the SSL certificate to use if HTTPS is supported.""")
@cli_util.option('--is-https-enabled', type=click.BOOL, help=u"""Enable or disable HTTPS support. If true, a `certificateId` is required. If unspecified, defaults to `false`.""")
@cli_util.option('--is-https-forced', type=click.BOOL, help=u"""Force HTTP to HTTPS redirection. If unspecified, defaults to `false`.""")
@cli_util.option('--tls-protocols', type=custom_types.CliCaseInsensitiveChoice(["TLS_V1", "TLS_V1_1", "TLS_V1_2", "TLS_V1_3"]), help=u"""A list of allowed TLS protocols. Only applicable when HTTPS support is enabled. It affects client's connection to the edge nodes. The most secure TLS version will be chosen. - **TLS_V1:** corresponds to TLS 1.0 specification.
- **TLS_V1_1:** corresponds to TLS 1.1 specification.
- **TLS_V1_2:** corresponds to TLS 1.2 specification.
- **TLS_V1_3:** corresponds to TLS 1.3 specification.
Enabled TLS protocols must go in a row. For example if TLS_v1_1 and TLS_V1_3 are enabled, TLS_V1_2 must be enabled too.""")
@cli_util.option('--is-origin-compression-enabled', type=click.BOOL, help=u"""Enable or disable GZIP compression of origin responses. If enabled, the header `Accept-Encoding: gzip` is sent to origin, otherwise - empty `Accept-Encoding:` header is used.""")
@cli_util.option('--is-behind-cdn', type=click.BOOL, help=u"""Enable or disable the use of CDN. It allows to specify true client IP address if clients do not connect directly to us.""")
@cli_util.option('--client-address-header', type=custom_types.CliCaseInsensitiveChoice(["X_FORWARDED_FOR", "X_CLIENT_IP", "X_REAL_IP", "CLIENT_IP", "TRUE_CLIENT_IP"]), help=u"""The HTTP header used to pass the client IP address from the CDN if `isBehindCdn` is enabled. This feature consumes the header and its value as the true client IP address. It does not create the header. Using trusted chains (for example `X-Client-Ip: 11.1.1.1, 13.3.3.3`), the last IP address in the list will be used as true client IP address. In case of multiple headers with the same name, the first one will be used. If the header is not present it will use the connecting IP address as the true client IP address. It's assumed that CDN sets the correct client IP address and prevents spoofing.
- **X_FORWARDED_FOR:** Corresponds to `X-Forwarded-For` header name.
- **X_CLIENT_IP:** Corresponds to `X-Client-Ip` header name.
- **X_REAL_IP:** Corresponds to `X-Real-Ip` header name.
- **CLIENT_IP:** Corresponds to `Client-Ip` header name.
- **TRUE_CLIENT_IP:** Corresponds to `True-Client-Ip` header name.""")
@cli_util.option('--is-cache-control-respected', type=click.BOOL, help=u"""Enable or disable automatic content caching based on the response `cache-control` header. This feature enables the origin to act as a proxy cache. Caching policies are usually defined using `cache-control` header. For example `cache-control: max-age=120` means that the returned resource is valid for 120 seconds. Caching rules will overwrite this setting.""")
@cli_util.option('--is-response-buffering-enabled', type=click.BOOL, help=u"""Enable or disable buffering of responses from the origin. Buffering improves overall stability in case of network issues, but slightly increases Time To First Byte.""")
@cli_util.option('--cipher-group', type=custom_types.CliCaseInsensitiveChoice(["DEFAULT"]), help=u"""The cipher group - **DEFAULT:** Cipher group supports TLS 1.0, TLS 1.1, TLS 1.2, TLS 1.3 protocols. It has the following ciphers enabled: `ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:!DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA`""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def update_policy_config(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, certificate_id, is_https_enabled, is_https_forced, tls_protocols, is_origin_compression_enabled, is_behind_cdn, client_address_header, is_cache_control_respected, is_response_buffering_enabled, cipher_group, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
if not force:
if tls_protocols:
if not click.confirm("WARNING: Updates to tls-protocols will replace any existing values. Are you sure you want to continue?"):
ctx.abort()
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
if certificate_id is not None:
details['certificateId'] = certificate_id
if is_https_enabled is not None:
details['isHttpsEnabled'] = is_https_enabled
if is_https_forced is not None:
details['isHttpsForced'] = is_https_forced
if tls_protocols is not None:
details['tlsProtocols'] = cli_util.parse_json_parameter("tls_protocols", tls_protocols)
if is_origin_compression_enabled is not None:
details['isOriginCompressionEnabled'] = is_origin_compression_enabled
if is_behind_cdn is not None:
details['isBehindCdn'] = is_behind_cdn
if client_address_header is not None:
details['clientAddressHeader'] = client_address_header
if is_cache_control_respected is not None:
details['isCacheControlRespected'] = is_cache_control_respected
if is_response_buffering_enabled is not None:
details['isResponseBufferingEnabled'] = is_response_buffering_enabled
if cipher_group is not None:
details['cipherGroup'] = cipher_group
client = cli_util.build_client('waas', ctx)
result = client.update_policy_config(
waas_policy_id=waas_policy_id,
update_policy_config_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@protection_rule_group.command(name=cli_util.override('update_protection_rules.command_name', 'update'), help=u"""Updates the action for each specified protection rule. Requests can either be allowed, blocked, or trigger an alert if they meet the parameters of an applied rule. For more information on protection rules, see [WAF Protection Rules]. This operation can update or disable protection rules depending on the structure of the request body. Protection rules can be updated by changing the properties of the protection rule object with the rule's key specified in the key field.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--protection-rules', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'protection-rules': {'module': 'waas', 'class': 'list[ProtectionRuleAction]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'protection-rules': {'module': 'waas', 'class': 'list[ProtectionRuleAction]'}})
@cli_util.wrap_exceptions
def update_protection_rules(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, protection_rules, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.update_protection_rules(
waas_policy_id=waas_policy_id,
protection_rules=cli_util.parse_json_parameter("protection_rules", protection_rules),
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@protection_settings_group.command(name=cli_util.override('update_protection_settings.command_name', 'update'), help=u"""Updates the protection settings in the Web Application Firewall configuration for a WAAS policy. Protection settings allow you define what action is taken when a request is blocked by the Web Application Firewall, such as returning a response code or block page. Only the fields specified in the request body will be updated; all other fields will remain unchanged.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--block-action', type=custom_types.CliCaseInsensitiveChoice(["SHOW_ERROR_PAGE", "SET_RESPONSE_CODE"]), help=u"""If `action` is set to `BLOCK`, this specifies how the traffic is blocked when detected as malicious by a protection rule. If unspecified, defaults to `SET_RESPONSE_CODE`.""")
@cli_util.option('--block-response-code', type=click.INT, help=u"""The response code returned when `action` is set to `BLOCK`, `blockAction` is set to `SET_RESPONSE_CODE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `403`.""")
@cli_util.option('--block-error-page-message', help=u"""The message to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to 'Access to the website is blocked.'""")
@cli_util.option('--block-error-page-code', help=u"""The error code to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `403`.""")
@cli_util.option('--block-error-page-description', help=u"""The description text to show on the error page when `action` is set to `BLOCK`, `blockAction` is set to `SHOW_ERROR_PAGE`, and the traffic is detected as malicious by a protection rule. If unspecified, defaults to `Access blocked by website owner. Please contact support.`""")
@cli_util.option('--max-argument-count', type=click.INT, help=u"""The maximum number of arguments allowed to be passed to your application before an action is taken. Arguements are query parameters or body parameters in a PUT or POST request. If unspecified, defaults to `255`. This setting only applies if a corresponding protection rule is enabled, such as the \"Number of Arguments Limits\" rule (key: 960335).
Example: If `maxArgumentCount` to `2` for the Max Number of Arguments protection rule (key: 960335), the following requests would be blocked: `GET /myapp/path?query=one&query=two&query=three` `POST /myapp/path` with Body `{\"argument1\":\"one\",\"argument2\":\"two\",\"argument3\":\"three\"}`""")
@cli_util.option('--max-name-length-per-argument', type=click.INT, help=u"""The maximum length allowed for each argument name, in characters. Arguements are query parameters or body parameters in a PUT or POST request. If unspecified, defaults to `400`. This setting only applies if a corresponding protection rule is enabled, such as the \"Values Limits\" rule (key: 960208).""")
@cli_util.option('--max-total-name-length-of-arguments', type=click.INT, help=u"""The maximum length allowed for the sum of the argument name and value, in characters. Arguements are query parameters or body parameters in a PUT or POST request. If unspecified, defaults to `64000`. This setting only applies if a corresponding protection rule is enabled, such as the \"Total Arguments Limits\" rule (key: 960341).""")
@cli_util.option('--recommendations-period-in-days', type=click.INT, help=u"""The length of time to analyze traffic traffic, in days. After the analysis period, `WafRecommendations` will be populated. If unspecified, defaults to `10`.
Use `GET /waasPolicies/{waasPolicyId}/wafRecommendations` to view WAF recommendations.""")
@cli_util.option('--is-response-inspected', type=click.BOOL, help=u"""Inspects the response body of origin responses. Can be used to detect leakage of sensitive data. If unspecified, defaults to `false`.
**Note:** Only origin responses with a Content-Type matching a value in `mediaTypes` will be inspected.""")
@cli_util.option('--max-response-size-in-ki-b', type=click.INT, help=u"""The maximum response size to be fully inspected, in binary kilobytes (KiB). Anything over this limit will be partially inspected. If unspecified, defaults to `1024`.""")
@cli_util.option('--allowed-http-methods', type=custom_types.CliCaseInsensitiveChoice(["OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT", "PATCH", "PROPFIND"]), help=u"""The list of allowed HTTP methods. If unspecified, default to `[OPTIONS, GET, HEAD, POST]`. This setting only applies if a corresponding protection rule is enabled, such as the \"Restrict HTTP Request Methods\" rule (key: 911100).""")
@cli_util.option('--media-types', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of media types to allow for inspection, if `isResponseInspected` is enabled. Only responses with MIME types in this list will be inspected. If unspecified, defaults to `[\"text/html\", \"text/plain\", \"text/xml\"]`.
Supported MIME types include:
- text/html - text/plain - text/asp - text/css - text/x-script - application/json - text/webviewhtml - text/x-java-source - application/x-javascript - application/javascript - application/ecmascript - text/javascript - text/ecmascript - text/x-script.perl - text/x-script.phyton - application/plain - application/xml - text/xml""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'media-types': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'media-types': {'module': 'waas', 'class': 'list[string]'}})
@cli_util.wrap_exceptions
def update_protection_settings(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, block_action, block_response_code, block_error_page_message, block_error_page_code, block_error_page_description, max_argument_count, max_name_length_per_argument, max_total_name_length_of_arguments, recommendations_period_in_days, is_response_inspected, max_response_size_in_ki_b, allowed_http_methods, media_types, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
if not force:
if allowed_http_methods or media_types:
if not click.confirm("WARNING: Updates to allowed-http-methods and media-types will replace any existing values. Are you sure you want to continue?"):
ctx.abort()
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
if block_action is not None:
details['blockAction'] = block_action
if block_response_code is not None:
details['blockResponseCode'] = block_response_code
if block_error_page_message is not None:
details['blockErrorPageMessage'] = block_error_page_message
if block_error_page_code is not None:
details['blockErrorPageCode'] = block_error_page_code
if block_error_page_description is not None:
details['blockErrorPageDescription'] = block_error_page_description
if max_argument_count is not None:
details['maxArgumentCount'] = max_argument_count
if max_name_length_per_argument is not None:
details['maxNameLengthPerArgument'] = max_name_length_per_argument
if max_total_name_length_of_arguments is not None:
details['maxTotalNameLengthOfArguments'] = max_total_name_length_of_arguments
if recommendations_period_in_days is not None:
details['recommendationsPeriodInDays'] = recommendations_period_in_days
if is_response_inspected is not None:
details['isResponseInspected'] = is_response_inspected
if max_response_size_in_ki_b is not None:
details['maxResponseSizeInKiB'] = max_response_size_in_ki_b
if allowed_http_methods is not None:
details['allowedHttpMethods'] = cli_util.parse_json_parameter("allowed_http_methods", allowed_http_methods)
if media_types is not None:
details['mediaTypes'] = cli_util.parse_json_parameter("media_types", media_types)
client = cli_util.build_client('waas', ctx)
result = client.update_protection_settings(
waas_policy_id=waas_policy_id,
update_protection_settings_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@threat_feed_group.command(name=cli_util.override('update_threat_feeds.command_name', 'update'), help=u"""Updates the action to take when a request's IP address matches an address in the specified threat intelligence feed. Threat intelligence feeds are compiled lists of IP addresses with malicious reputations based on internet intelligence. Only the threat feeds specified in the request body will be updated; all other threat feeds will remain unchanged.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--threat-feeds', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of threat feeds for which to update the actions.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'threat-feeds': {'module': 'waas', 'class': 'list[ThreatFeedAction]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'threat-feeds': {'module': 'waas', 'class': 'list[ThreatFeedAction]'}})
@cli_util.wrap_exceptions
def update_threat_feeds(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, threat_feeds, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.update_threat_feeds(
waas_policy_id=waas_policy_id,
threat_feeds=cli_util.parse_json_parameter("threat_feeds", threat_feeds),
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@waas_policy_group.command(name=cli_util.override('update_waas_policy.command_name', 'update'), help=u"""Updates the details of a WAAS policy, including origins and tags. Only the fields specified in the request body will be updated; all other properties will remain unchanged. To update platform provided resources such as `GoodBots`, `ProtectionRules`, and `ThreatFeeds`, first retrieve the list of available resources with the related list operation such as `GetThreatFeeds` or `GetProtectionRules`. The returned list will contain objects with `key` properties that can be used to update the resource during the `UpdateWaasPolicy` request.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--display-name', help=u"""A user-friendly name for the WAAS policy. The name can be changed and does not need to be unique.""")
@cli_util.option('--additional-domains', type=custom_types.CLI_COMPLEX_TYPE, help=u"""An array of additional domains protected by this WAAS policy.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--origins', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A map of host to origin for the web application. The key should be a customer friendly name for the host, ex. primary, secondary, etc.
This option is a JSON dictionary of type dict(str, Origin). For documentation on Origin please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/Origin.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--origin-groups', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The map of origin groups and their keys used to associate origins to the wafConfig.
This option is a JSON dictionary of type dict(str, OriginGroup). For documentation on OriginGroup please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/OriginGroup.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--policy-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--waf-config', type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--freeform-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags].
Example: `{\"Department\": \"Finance\"}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--defined-tags', type=custom_types.CLI_COMPLEX_TYPE, help=u"""Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags].
Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'additional-domains': {'module': 'waas', 'class': 'list[string]'}, 'origins': {'module': 'waas', 'class': 'dict(str, Origin)'}, 'origin-groups': {'module': 'waas', 'class': 'dict(str, OriginGroup)'}, 'policy-config': {'module': 'waas', 'class': 'PolicyConfig'}, 'waf-config': {'module': 'waas', 'class': 'WafConfig'}, 'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'additional-domains': {'module': 'waas', 'class': 'list[string]'}, 'origins': {'module': 'waas', 'class': 'dict(str, Origin)'}, 'origin-groups': {'module': 'waas', 'class': 'dict(str, OriginGroup)'}, 'policy-config': {'module': 'waas', 'class': 'PolicyConfig'}, 'waf-config': {'module': 'waas', 'class': 'WafConfig'}, 'freeform-tags': {'module': 'waas', 'class': 'dict(str, string)'}, 'defined-tags': {'module': 'waas', 'class': 'dict(str, dict(str, object))'}})
@cli_util.wrap_exceptions
def update_waas_policy(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, display_name, additional_domains, origins, origin_groups, policy_config, waf_config, freeform_tags, defined_tags, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
if not force:
if additional_domains or origins or origin_groups or policy_config or waf_config or freeform_tags or defined_tags:
if not click.confirm("WARNING: Updates to additional-domains and origins and origin-groups and policy-config and waf-config and freeform-tags and defined-tags will replace any existing values. Are you sure you want to continue?"):
ctx.abort()
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
if display_name is not None:
details['displayName'] = display_name
if additional_domains is not None:
details['additionalDomains'] = cli_util.parse_json_parameter("additional_domains", additional_domains)
if origins is not None:
details['origins'] = cli_util.parse_json_parameter("origins", origins)
if origin_groups is not None:
details['originGroups'] = cli_util.parse_json_parameter("origin_groups", origin_groups)
if policy_config is not None:
details['policyConfig'] = cli_util.parse_json_parameter("policy_config", policy_config)
if waf_config is not None:
details['wafConfig'] = cli_util.parse_json_parameter("waf_config", waf_config)
if freeform_tags is not None:
details['freeformTags'] = cli_util.parse_json_parameter("freeform_tags", freeform_tags)
if defined_tags is not None:
details['definedTags'] = cli_util.parse_json_parameter("defined_tags", defined_tags)
client = cli_util.build_client('waas', ctx)
result = client.update_waas_policy(
waas_policy_id=waas_policy_id,
update_waas_policy_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@custom_protection_rule_setting_group.command(name=cli_util.override('update_waas_policy_custom_protection_rules.command_name', 'update-waas-policy-custom-protection-rules'), help=u"""Updates the action for each specified custom protection rule. Only the `DETECT` and `BLOCK` actions can be set. Disabled rules should not be included in the list. For more information on protection rules, see [WAF Protection Rules].""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--update-custom-protection-rules-details', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'update-custom-protection-rules-details': {'module': 'waas', 'class': 'list[CustomProtectionRuleSetting]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'update-custom-protection-rules-details': {'module': 'waas', 'class': 'list[CustomProtectionRuleSetting]'}})
@cli_util.wrap_exceptions
def update_waas_policy_custom_protection_rules(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, update_custom_protection_rules_details, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.update_waas_policy_custom_protection_rules(
waas_policy_id=waas_policy_id,
update_custom_protection_rules_details=cli_util.parse_json_parameter("update_custom_protection_rules_details", update_custom_protection_rules_details),
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@address_rate_limiting_group.command(name=cli_util.override('update_waf_address_rate_limiting.command_name', 'update-waf'), help=u"""Updates the address rate limiting settings in the Web Application Firewall configuration for a policy. Rate limiting allows you to configure a threshold for the number of requests from a unique IP address for the given period. You can also define the response code for the requests from the same address that exceed the threshold.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--is-enabled', required=True, type=click.BOOL, help=u"""Enables or disables the address rate limiting Web Application Firewall feature.""")
@cli_util.option('--allowed-rate-per-address', type=click.INT, help=u"""The number of allowed requests per second from one IP address. If unspecified, defaults to `1`.""")
@cli_util.option('--max-delayed-count-per-address', type=click.INT, help=u"""The maximum number of requests allowed to be queued before subsequent requests are dropped. If unspecified, defaults to `10`.""")
@cli_util.option('--block-response-code', type=click.INT, help=u"""The response status code returned when a request is blocked. If unspecified, defaults to `503`.""")
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={})
@cli_util.wrap_exceptions
def update_waf_address_rate_limiting(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, is_enabled, allowed_rate_per_address, max_delayed_count_per_address, block_response_code, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
details['isEnabled'] = is_enabled
if allowed_rate_per_address is not None:
details['allowedRatePerAddress'] = allowed_rate_per_address
if max_delayed_count_per_address is not None:
details['maxDelayedCountPerAddress'] = max_delayed_count_per_address
if block_response_code is not None:
details['blockResponseCode'] = block_response_code
client = cli_util.build_client('waas', ctx)
result = client.update_waf_address_rate_limiting(
waas_policy_id=waas_policy_id,
update_waf_address_rate_limiting_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@waf_config_group.command(name=cli_util.override('update_waf_config.command_name', 'update'), help=u"""Updates the Web Application Firewall configuration for a specified WAAS policy.
To update platform provided resources such as `GoodBots`, `ProtectionRules`, and `ThreatFeeds`, first retrieve the list of available resources with the related list operation, such as `GetThreatFeeds` or `GetProtectionRules`.
The returned list will contain objects with `key` properties that can be used to update the resource during the `UpdateWafConfig` request.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--access-rules', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The access rules applied to the Web Application Firewall. Used for defining custom access policies with the combination of `ALLOW`, `DETECT`, and `BLOCK` rules, based on different criteria.
This option is a JSON list with items of type AccessRule. For documentation on AccessRule please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/AccessRule.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--address-rate-limiting', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The IP address rate limiting settings used to limit the number of requests from an address.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--captchas', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of CAPTCHA challenge settings. These are used to challenge requests with a CAPTCHA to block bots.
This option is a JSON list with items of type Captcha. For documentation on Captcha please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/Captcha.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--device-fingerprint-challenge', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The device fingerprint challenge settings. Used to detect unique devices based on the device fingerprint information collected in order to block bots.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--good-bots', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of bots allowed to access the web application.
This option is a JSON list with items of type GoodBot. For documentation on GoodBot please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/GoodBot.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--human-interaction-challenge', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The human interaction challenge settings. Used to look for natural human interactions such as mouse movements, time on site, and page scrolling to identify bots.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--js-challenge', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The JavaScript challenge settings. Used to challenge requests with a JavaScript challenge and take the action if a browser has no JavaScript support in order to block bots.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--origin', help=u"""The key in the map of origins referencing the origin used for the Web Application Firewall. The origin must already be included in `Origins`. Required when creating the `WafConfig` resource, but not on update.""")
@cli_util.option('--caching-rules', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of caching rules applied to the web application.
This option is a JSON list with items of type CachingRule. For documentation on CachingRule please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/CachingRule.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--custom-protection-rules', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of the custom protection rule OCIDs and their actions.
This option is a JSON list with items of type CustomProtectionRuleSetting. For documentation on CustomProtectionRuleSetting please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/CustomProtectionRuleSetting.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--origin-groups', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The list of origin group references that provide support for additional origin servers. A list of combined unique origin servers from `origin` and `originGroups` will be used.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--protection-rules', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of the protection rules and their details.
This option is a JSON list with items of type ProtectionRule. For documentation on ProtectionRule please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/ProtectionRule.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--protection-settings', type=custom_types.CLI_COMPLEX_TYPE, help=u"""The settings to apply to protection rules.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--threat-feeds', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of threat intelligence feeds and the actions to apply to known malicious traffic based on internet intelligence.
This option is a JSON list with items of type ThreatFeed. For documentation on ThreatFeed please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/ThreatFeed.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--whitelists', type=custom_types.CLI_COMPLEX_TYPE, help=u"""A list of IP addresses that bypass the Web Application Firewall.
This option is a JSON list with items of type Whitelist. For documentation on Whitelist please see our API reference: https://docs.cloud.oracle.com/api/#/en/waas/20181116/datatypes/Whitelist.""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--force', help="""Perform update without prompting for confirmation.""", is_flag=True)
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'access-rules': {'module': 'waas', 'class': 'list[AccessRule]'}, 'address-rate-limiting': {'module': 'waas', 'class': 'AddressRateLimiting'}, 'captchas': {'module': 'waas', 'class': 'list[Captcha]'}, 'device-fingerprint-challenge': {'module': 'waas', 'class': 'DeviceFingerprintChallenge'}, 'good-bots': {'module': 'waas', 'class': 'list[GoodBot]'}, 'human-interaction-challenge': {'module': 'waas', 'class': 'HumanInteractionChallenge'}, 'js-challenge': {'module': 'waas', 'class': 'JsChallenge'}, 'caching-rules': {'module': 'waas', 'class': 'list[CachingRule]'}, 'custom-protection-rules': {'module': 'waas', 'class': 'list[CustomProtectionRuleSetting]'}, 'origin-groups': {'module': 'waas', 'class': 'list[string]'}, 'protection-rules': {'module': 'waas', 'class': 'list[ProtectionRule]'}, 'protection-settings': {'module': 'waas', 'class': 'ProtectionSettings'}, 'threat-feeds': {'module': 'waas', 'class': 'list[ThreatFeed]'}, 'whitelists': {'module': 'waas', 'class': 'list[Whitelist]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'access-rules': {'module': 'waas', 'class': 'list[AccessRule]'}, 'address-rate-limiting': {'module': 'waas', 'class': 'AddressRateLimiting'}, 'captchas': {'module': 'waas', 'class': 'list[Captcha]'}, 'device-fingerprint-challenge': {'module': 'waas', 'class': 'DeviceFingerprintChallenge'}, 'good-bots': {'module': 'waas', 'class': 'list[GoodBot]'}, 'human-interaction-challenge': {'module': 'waas', 'class': 'HumanInteractionChallenge'}, 'js-challenge': {'module': 'waas', 'class': 'JsChallenge'}, 'caching-rules': {'module': 'waas', 'class': 'list[CachingRule]'}, 'custom-protection-rules': {'module': 'waas', 'class': 'list[CustomProtectionRuleSetting]'}, 'origin-groups': {'module': 'waas', 'class': 'list[string]'}, 'protection-rules': {'module': 'waas', 'class': 'list[ProtectionRule]'}, 'protection-settings': {'module': 'waas', 'class': 'ProtectionSettings'}, 'threat-feeds': {'module': 'waas', 'class': 'list[ThreatFeed]'}, 'whitelists': {'module': 'waas', 'class': 'list[Whitelist]'}})
@cli_util.wrap_exceptions
def update_waf_config(ctx, from_json, force, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, access_rules, address_rate_limiting, captchas, device_fingerprint_challenge, good_bots, human_interaction_challenge, js_challenge, origin, caching_rules, custom_protection_rules, origin_groups, protection_rules, protection_settings, threat_feeds, whitelists, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
if not force:
if access_rules or address_rate_limiting or captchas or device_fingerprint_challenge or good_bots or human_interaction_challenge or js_challenge or caching_rules or custom_protection_rules or origin_groups or protection_rules or protection_settings or threat_feeds or whitelists:
if not click.confirm("WARNING: Updates to access-rules and address-rate-limiting and captchas and device-fingerprint-challenge and good-bots and human-interaction-challenge and js-challenge and caching-rules and custom-protection-rules and origin-groups and protection-rules and protection-settings and threat-feeds and whitelists will replace any existing values. Are you sure you want to continue?"):
ctx.abort()
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
details = {}
if access_rules is not None:
details['accessRules'] = cli_util.parse_json_parameter("access_rules", access_rules)
if address_rate_limiting is not None:
details['addressRateLimiting'] = cli_util.parse_json_parameter("address_rate_limiting", address_rate_limiting)
if captchas is not None:
details['captchas'] = cli_util.parse_json_parameter("captchas", captchas)
if device_fingerprint_challenge is not None:
details['deviceFingerprintChallenge'] = cli_util.parse_json_parameter("device_fingerprint_challenge", device_fingerprint_challenge)
if good_bots is not None:
details['goodBots'] = cli_util.parse_json_parameter("good_bots", good_bots)
if human_interaction_challenge is not None:
details['humanInteractionChallenge'] = cli_util.parse_json_parameter("human_interaction_challenge", human_interaction_challenge)
if js_challenge is not None:
details['jsChallenge'] = cli_util.parse_json_parameter("js_challenge", js_challenge)
if origin is not None:
details['origin'] = origin
if caching_rules is not None:
details['cachingRules'] = cli_util.parse_json_parameter("caching_rules", caching_rules)
if custom_protection_rules is not None:
details['customProtectionRules'] = cli_util.parse_json_parameter("custom_protection_rules", custom_protection_rules)
if origin_groups is not None:
details['originGroups'] = cli_util.parse_json_parameter("origin_groups", origin_groups)
if protection_rules is not None:
details['protectionRules'] = cli_util.parse_json_parameter("protection_rules", protection_rules)
if protection_settings is not None:
details['protectionSettings'] = cli_util.parse_json_parameter("protection_settings", protection_settings)
if threat_feeds is not None:
details['threatFeeds'] = cli_util.parse_json_parameter("threat_feeds", threat_feeds)
if whitelists is not None:
details['whitelists'] = cli_util.parse_json_parameter("whitelists", whitelists)
client = cli_util.build_client('waas', ctx)
result = client.update_waf_config(
waas_policy_id=waas_policy_id,
update_waf_config_details=details,
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
@whitelist_group.command(name=cli_util.override('update_whitelists.command_name', 'update'), help=u"""Updates the list of IP addresses that bypass the Web Application Firewall for a WAAS policy. Supports both single IP addresses or subnet masks (CIDR notation).
This operation can create, delete, update, and/or reorder whitelists depending on the structure of the request body.
Whitelists can be updated by changing the properties of the whitelist object with the rule's key specified in the `key` field. Whitelists can be reordered by changing the order of the whitelists in the list of objects when updating.
Whitelists can be created by adding a new whitelist object to the list without a `key` property specified. A `key` will be generated for the new whitelist upon update.
Whitelists can be deleted by removing the existing whitelist object from the list. Any existing whitelists that are not specified with a `key` in the list of access rules will be deleted upon update.""")
@cli_util.option('--waas-policy-id', required=True, help=u"""The [OCID] of the WAAS policy.""")
@cli_util.option('--whitelists', required=True, type=custom_types.CLI_COMPLEX_TYPE, help=u"""""" + custom_types.cli_complex_type.COMPLEX_TYPE_HELP)
@cli_util.option('--if-match', help=u"""For optimistic concurrency control. In the `PUT` or `DELETE` call for a resource, set the `if-match` parameter to the value of the etag from a previous `GET` or `POST` response for that resource. The resource will be updated or deleted only if the etag provided matches the resource's current etag value.""")
@cli_util.option('--wait-for-state', type=custom_types.CliCaseInsensitiveChoice(["ACCEPTED", "IN_PROGRESS", "FAILED", "SUCCEEDED", "CANCELING", "CANCELED"]), help="""This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Specify this option to perform the action and then wait until the work request reaches a certain state. If timeout is reached, a return code of 2 is returned. For any other error, a return code of 1 is returned.""")
@cli_util.option('--max-wait-seconds', type=click.INT, help="""The maximum time to wait for the work request to reach the state defined by --wait-for-state. Defaults to 1200 seconds.""")
@cli_util.option('--wait-interval-seconds', type=click.INT, help="""Check every --wait-interval-seconds to see whether the work request to see if it has reached the state defined by --wait-for-state. Defaults to 30 seconds.""")
@json_skeleton_utils.get_cli_json_input_option({'whitelists': {'module': 'waas', 'class': 'list[Whitelist]'}})
@cli_util.help_option
@click.pass_context
@json_skeleton_utils.json_skeleton_generation_handler(input_params_to_complex_types={'whitelists': {'module': 'waas', 'class': 'list[Whitelist]'}})
@cli_util.wrap_exceptions
def update_whitelists(ctx, from_json, wait_for_state, max_wait_seconds, wait_interval_seconds, waas_policy_id, whitelists, if_match):
if isinstance(waas_policy_id, six.string_types) and len(waas_policy_id.strip()) == 0:
raise click.UsageError('Parameter --waas-policy-id cannot be whitespace or empty string')
kwargs = {}
if if_match is not None:
kwargs['if_match'] = if_match
kwargs['opc_request_id'] = cli_util.use_or_generate_request_id(ctx.obj['request_id'])
client = cli_util.build_client('waas', ctx)
result = client.update_whitelists(
waas_policy_id=waas_policy_id,
whitelists=cli_util.parse_json_parameter("whitelists", whitelists),
**kwargs
)
if wait_for_state:
if hasattr(client, 'get_work_request') and callable(getattr(client, 'get_work_request')):
try:
wait_period_kwargs = {}
if max_wait_seconds is not None:
wait_period_kwargs['max_wait_seconds'] = max_wait_seconds
if wait_interval_seconds is not None:
wait_period_kwargs['max_interval_seconds'] = wait_interval_seconds
click.echo('Action completed. Waiting until the work request has entered state: {}'.format(wait_for_state), file=sys.stderr)
result = oci.wait_until(client, client.get_work_request(result.headers['opc-work-request-id']), 'status', wait_for_state, **wait_period_kwargs)
except oci.exceptions.MaximumWaitTimeExceeded as e:
# If we fail, we should show an error, but we should still provide the information to the customer
click.echo('Failed to wait until the work request entered the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
sys.exit(2)
except Exception:
click.echo('Encountered error while waiting for work request to enter the specified state. Outputting last known resource state', file=sys.stderr)
cli_util.render_response(result, ctx)
raise
else:
click.echo('Unable to wait for the work request to enter the specified state', file=sys.stderr)
cli_util.render_response(result, ctx)
| 74.999246
| 1,085
| 0.729111
| 42,780
| 298,347
| 4.883567
| 0.02604
| 0.035985
| 0.028375
| 0.012464
| 0.888651
| 0.868351
| 0.847683
| 0.82891
| 0.812329
| 0.795509
| 0
| 0.003603
| 0.16094
| 298,347
| 3,977
| 1,086
| 75.018104
| 0.830968
| 0.015526
| 0
| 0.751054
| 0
| 0.107766
| 0.45548
| 0.036526
| 0
| 0
| 0
| 0
| 0
| 1
| 0.028597
| false
| 0.032812
| 0.004214
| 0
| 0.032812
| 0.00873
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
c11e90eba4eaf4106afba5b9460a4ced360e581e
| 11,057
|
py
|
Python
|
boto3_type_annotations_with_docs/boto3_type_annotations/opsworks/waiter.py
|
cowboygneox/boto3_type_annotations
|
450dce1de4e066b939de7eac2ec560ed1a7ddaa2
|
[
"MIT"
] | 119
|
2018-12-01T18:20:57.000Z
|
2022-02-02T10:31:29.000Z
|
boto3_type_annotations_with_docs/boto3_type_annotations/opsworks/waiter.py
|
cowboygneox/boto3_type_annotations
|
450dce1de4e066b939de7eac2ec560ed1a7ddaa2
|
[
"MIT"
] | 15
|
2018-11-16T00:16:44.000Z
|
2021-11-13T03:44:18.000Z
|
boto3_type_annotations_with_docs/boto3_type_annotations/opsworks/waiter.py
|
cowboygneox/boto3_type_annotations
|
450dce1de4e066b939de7eac2ec560ed1a7ddaa2
|
[
"MIT"
] | 11
|
2019-05-06T05:26:51.000Z
|
2021-09-28T15:27:59.000Z
|
from typing import Dict
from typing import List
from botocore.waiter import Waiter
class AppExists(Waiter):
def wait(self, StackId: str = None, AppIds: List = None, WaiterConfig: Dict = None):
"""
Polls :py:meth:`OpsWorks.Client.describe_apps` every 1 seconds until a successful state is reached. An error is returned after 40 failed checks.
See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeApps>`_
**Request Syntax**
::
waiter.wait(
StackId='string',
AppIds=[
'string',
],
WaiterConfig={
'Delay': 123,
'MaxAttempts': 123
}
)
:type StackId: string
:param StackId:
The app stack ID. If you use this parameter, ``DescribeApps`` returns a description of the apps in the specified stack.
:type AppIds: list
:param AppIds:
An array of app IDs for the apps to be described. If you use this parameter, ``DescribeApps`` returns a description of the specified apps. Otherwise, it returns a description of every app.
- *(string) --*
:type WaiterConfig: dict
:param WaiterConfig:
A dictionary that provides parameters to control waiting behavior.
- **Delay** *(integer) --*
The amount of time in seconds to wait between attempts. Default: 1
- **MaxAttempts** *(integer) --*
The maximum number of attempts to be made. Default: 40
:returns: None
"""
pass
class DeploymentSuccessful(Waiter):
def wait(self, StackId: str = None, AppId: str = None, DeploymentIds: List = None, WaiterConfig: Dict = None):
"""
Polls :py:meth:`OpsWorks.Client.describe_deployments` every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeDeployments>`_
**Request Syntax**
::
waiter.wait(
StackId='string',
AppId='string',
DeploymentIds=[
'string',
],
WaiterConfig={
'Delay': 123,
'MaxAttempts': 123
}
)
:type StackId: string
:param StackId:
The stack ID. If you include this parameter, the command returns a description of the commands associated with the specified stack.
:type AppId: string
:param AppId:
The app ID. If you include this parameter, the command returns a description of the commands associated with the specified app.
:type DeploymentIds: list
:param DeploymentIds:
An array of deployment IDs to be described. If you include this parameter, the command returns a description of the specified deployments. Otherwise, it returns a description of every deployment.
- *(string) --*
:type WaiterConfig: dict
:param WaiterConfig:
A dictionary that provides parameters to control waiting behavior.
- **Delay** *(integer) --*
The amount of time in seconds to wait between attempts. Default: 15
- **MaxAttempts** *(integer) --*
The maximum number of attempts to be made. Default: 40
:returns: None
"""
pass
class InstanceOnline(Waiter):
def wait(self, StackId: str = None, LayerId: str = None, InstanceIds: List = None, WaiterConfig: Dict = None):
"""
Polls :py:meth:`OpsWorks.Client.describe_instances` every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeInstances>`_
**Request Syntax**
::
waiter.wait(
StackId='string',
LayerId='string',
InstanceIds=[
'string',
],
WaiterConfig={
'Delay': 123,
'MaxAttempts': 123
}
)
:type StackId: string
:param StackId:
A stack ID. If you use this parameter, ``DescribeInstances`` returns descriptions of the instances associated with the specified stack.
:type LayerId: string
:param LayerId:
A layer ID. If you use this parameter, ``DescribeInstances`` returns descriptions of the instances associated with the specified layer.
:type InstanceIds: list
:param InstanceIds:
An array of instance IDs to be described. If you use this parameter, ``DescribeInstances`` returns a description of the specified instances. Otherwise, it returns a description of every instance.
- *(string) --*
:type WaiterConfig: dict
:param WaiterConfig:
A dictionary that provides parameters to control waiting behavior.
- **Delay** *(integer) --*
The amount of time in seconds to wait between attempts. Default: 15
- **MaxAttempts** *(integer) --*
The maximum number of attempts to be made. Default: 40
:returns: None
"""
pass
class InstanceRegistered(Waiter):
def wait(self, StackId: str = None, LayerId: str = None, InstanceIds: List = None, WaiterConfig: Dict = None):
"""
Polls :py:meth:`OpsWorks.Client.describe_instances` every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeInstances>`_
**Request Syntax**
::
waiter.wait(
StackId='string',
LayerId='string',
InstanceIds=[
'string',
],
WaiterConfig={
'Delay': 123,
'MaxAttempts': 123
}
)
:type StackId: string
:param StackId:
A stack ID. If you use this parameter, ``DescribeInstances`` returns descriptions of the instances associated with the specified stack.
:type LayerId: string
:param LayerId:
A layer ID. If you use this parameter, ``DescribeInstances`` returns descriptions of the instances associated with the specified layer.
:type InstanceIds: list
:param InstanceIds:
An array of instance IDs to be described. If you use this parameter, ``DescribeInstances`` returns a description of the specified instances. Otherwise, it returns a description of every instance.
- *(string) --*
:type WaiterConfig: dict
:param WaiterConfig:
A dictionary that provides parameters to control waiting behavior.
- **Delay** *(integer) --*
The amount of time in seconds to wait between attempts. Default: 15
- **MaxAttempts** *(integer) --*
The maximum number of attempts to be made. Default: 40
:returns: None
"""
pass
class InstanceStopped(Waiter):
def wait(self, StackId: str = None, LayerId: str = None, InstanceIds: List = None, WaiterConfig: Dict = None):
"""
Polls :py:meth:`OpsWorks.Client.describe_instances` every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeInstances>`_
**Request Syntax**
::
waiter.wait(
StackId='string',
LayerId='string',
InstanceIds=[
'string',
],
WaiterConfig={
'Delay': 123,
'MaxAttempts': 123
}
)
:type StackId: string
:param StackId:
A stack ID. If you use this parameter, ``DescribeInstances`` returns descriptions of the instances associated with the specified stack.
:type LayerId: string
:param LayerId:
A layer ID. If you use this parameter, ``DescribeInstances`` returns descriptions of the instances associated with the specified layer.
:type InstanceIds: list
:param InstanceIds:
An array of instance IDs to be described. If you use this parameter, ``DescribeInstances`` returns a description of the specified instances. Otherwise, it returns a description of every instance.
- *(string) --*
:type WaiterConfig: dict
:param WaiterConfig:
A dictionary that provides parameters to control waiting behavior.
- **Delay** *(integer) --*
The amount of time in seconds to wait between attempts. Default: 15
- **MaxAttempts** *(integer) --*
The maximum number of attempts to be made. Default: 40
:returns: None
"""
pass
class InstanceTerminated(Waiter):
def wait(self, StackId: str = None, LayerId: str = None, InstanceIds: List = None, WaiterConfig: Dict = None):
"""
Polls :py:meth:`OpsWorks.Client.describe_instances` every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/opsworks-2013-02-18/DescribeInstances>`_
**Request Syntax**
::
waiter.wait(
StackId='string',
LayerId='string',
InstanceIds=[
'string',
],
WaiterConfig={
'Delay': 123,
'MaxAttempts': 123
}
)
:type StackId: string
:param StackId:
A stack ID. If you use this parameter, ``DescribeInstances`` returns descriptions of the instances associated with the specified stack.
:type LayerId: string
:param LayerId:
A layer ID. If you use this parameter, ``DescribeInstances`` returns descriptions of the instances associated with the specified layer.
:type InstanceIds: list
:param InstanceIds:
An array of instance IDs to be described. If you use this parameter, ``DescribeInstances`` returns a description of the specified instances. Otherwise, it returns a description of every instance.
- *(string) --*
:type WaiterConfig: dict
:param WaiterConfig:
A dictionary that provides parameters to control waiting behavior.
- **Delay** *(integer) --*
The amount of time in seconds to wait between attempts. Default: 15
- **MaxAttempts** *(integer) --*
The maximum number of attempts to be made. Default: 40
:returns: None
"""
pass
| 44.947154
| 205
| 0.599982
| 1,193
| 11,057
| 5.550712
| 0.104778
| 0.012836
| 0.043038
| 0.047569
| 0.927514
| 0.927514
| 0.910148
| 0.888553
| 0.88659
| 0.88659
| 0
| 0.017184
| 0.315818
| 11,057
| 245
| 206
| 45.130612
| 0.858163
| 0.749299
| 0
| 0.47619
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.285714
| 0.142857
| 0
| 0.714286
| 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
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 8
|
c1750929afeab7906d139305e92b47f91306ebbb
| 5,552
|
py
|
Python
|
clean_py/tests/conftest.py
|
ccc118/clean-py
|
47d9b19e625b8d3b08555809291056d96e421e64
|
[
"MIT"
] | null | null | null |
clean_py/tests/conftest.py
|
ccc118/clean-py
|
47d9b19e625b8d3b08555809291056d96e421e64
|
[
"MIT"
] | null | null | null |
clean_py/tests/conftest.py
|
ccc118/clean-py
|
47d9b19e625b8d3b08555809291056d96e421e64
|
[
"MIT"
] | null | null | null |
import os
import sys
from pathlib import Path
import pytest
def pytest_configure():
pytest.test_dir = Path(os.path.dirname(os.path.realpath(__file__)))
pytest.file_dir = pytest.test_dir / "test_files"
pytest.example_notebook = pytest.file_dir / "example_notebook.ipynb"
pytest.example_script = pytest.file_dir / "example_script.py"
@pytest.fixture
def black_playground_template_input():
return """from seven_dwwarfs import Grumpy, Happy, Sleepy, Bashful, Sneezy, Dopey, Doc
import sklearn
from glob import glob
x = { 'a':37,'b':42,
'c':927}
x = 123456789.123456789E123456789
if very_long_variable_name is not None and \
very_long_variable_name.field > 0 or \
very_long_variable_name.is_debug:
z = 'hello '+'world'
else:
world = 'world'
a = 'hello {}'.format(world)
f = rf'hello {world}'
if (this
and that): y = 'hello ''world'#FIXME: https://github.com/python/black/issues/26
class Foo ( object ):
def f (self ):
return 37*-2
def g(self, x,y=42):
return y
def f ( a: List[ int ]) :
return 37-a[42-u : y**3]
def very_important_function(template: str,*variables,file: os.PathLike,debug:bool=False,):
with open(file, "w") as f:
...
# fmt: off
custom_formatting = [
0, 1, 2,
3, 4, 5,
6, 7, 8,
]
# fmt: on
regular_formatting = [
0, 1, 2,
3, 4, 5,
6, 7, 8,
]"""
@pytest.fixture
def apply_all():
return """x = {"a": 37, "b": 42, "c": 927}\n\nx = 123456789.123456789e123456789\n\nif (\n very_long_variable_name is not None\n and very_long_variable_name.field > 0\n or very_long_variable_name.is_debug\n):\n z = "hello " + "world"\nelse:\n world = "world"\n a = "hello {}".format(world)\n f = rf"hello {world}"\nif this and that:\n y = "hello " "world" # FIXME: https://github.com/python/black/issues/26\n\n\nclass Foo(object):\n def f(self):\n return 37 * -2\n\n def g(self, x, y=42):\n return y\n\n\ndef f(a: List[int]):\n return 37 - a[42 - u : y**3]\n\n\ndef very_important_function(\n template: str,\n *variables,\n file: os.PathLike,\n debug: bool = False,\n):\n with open(file, "w") as f:\n ...\n\n\n# fmt: off\ncustom_formatting = [\n 0, 1, 2,\n 3, 4, 5,\n 6, 7, 8,\n]\n# fmt: on\nregular_formatting = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n]\n"""
@pytest.fixture
def isort_only():
return """from glob import glob\n\nimport sklearn\n\nfrom seven_dwwarfs import Bashful, Doc, Dopey, Grumpy, Happy, Sleepy, Sneezy\n\nx = { \'a\':37,\'b\':42,\n\n\'c\':927}\n\nx = 123456789.123456789E123456789\n\nif very_long_variable_name is not None and very_long_variable_name.field > 0 or very_long_variable_name.is_debug:\n z = \'hello \'+\'world\'\nelse:\n world = \'world\'\n a = \'hello {}\'.format(world)\n f = rf\'hello {world}\'\nif (this\nand that): y = \'hello \'\'world\'#FIXME: https://github.com/python/black/issues/26\nclass Foo ( object ):\n def f (self ):\n return 37*-2\n def g(self, x,y=42):\n return y\ndef f ( a: List[ int ]) :\n return 37-a[42-u : y**3]\ndef very_important_function(template: str,*variables,file: os.PathLike,debug:bool=False,):\n with open(file, "w") as f:\n ...\n# fmt: off\ncustom_formatting = [\n 0, 1, 2,\n 3, 4, 5,\n 6, 7, 8,\n]\n# fmt: on\nregular_formatting = [\n 0, 1, 2,\n 3, 4, 5,\n 6, 7, 8,\n]\n"""
@pytest.fixture
def black_only():
return """from seven_dwwarfs import Grumpy, Happy, Sleepy, Bashful, Sneezy, Dopey, Doc\nimport sklearn\nfrom glob import glob\n\nx = {"a": 37, "b": 42, "c": 927}\n\nx = 123456789.123456789e123456789\n\nif (\n very_long_variable_name is not None\n and very_long_variable_name.field > 0\n or very_long_variable_name.is_debug\n):\n z = "hello " + "world"\nelse:\n world = "world"\n a = "hello {}".format(world)\n f = rf"hello {world}"\nif this and that:\n y = "hello " "world" # FIXME: https://github.com/python/black/issues/26\n\n\nclass Foo(object):\n def f(self):\n return 37 * -2\n\n def g(self, x, y=42):\n return y\n\n\ndef f(a: List[int]):\n return 37 - a[42 - u : y**3]\n\n\ndef very_important_function(\n template: str,\n *variables,\n file: os.PathLike,\n debug: bool = False,\n):\n with open(file, "w") as f:\n ...\n\n\n# fmt: off\ncustom_formatting = [\n 0, 1, 2,\n 3, 4, 5,\n 6, 7, 8,\n]\n# fmt: on\nregular_formatting = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n]\n"""
@pytest.fixture
def autoflake_only():
return """\nx = { \'a\':37,\'b\':42,\n\n\'c\':927}\n\nx = 123456789.123456789E123456789\n\nif very_long_variable_name is not None and very_long_variable_name.field > 0 or very_long_variable_name.is_debug:\n z = \'hello \'+\'world\'\nelse:\n world = \'world\'\n a = \'hello {}\'.format(world)\n f = rf\'hello {world}\'\nif (this\nand that): y = \'hello \'\'world\'#FIXME: https://github.com/python/black/issues/26\nclass Foo ( object ):\n def f (self ):\n return 37*-2\n def g(self, x,y=42):\n return y\ndef f ( a: List[ int ]) :\n return 37-a[42-u : y**3]\ndef very_important_function(template: str,*variables,file: os.PathLike,debug:bool=False,):\n with open(file, "w") as f:\n ...\n# fmt: off\ncustom_formatting = [\n 0, 1, 2,\n 3, 4, 5,\n 6, 7, 8,\n]\n# fmt: on\nregular_formatting = [\n 0, 1, 2,\n 3, 4, 5,\n 6, 7, 8,\n]"""
| 70.278481
| 1,101
| 0.604287
| 961
| 5,552
| 3.3923
| 0.130073
| 0.017791
| 0.07362
| 0.092025
| 0.785276
| 0.785276
| 0.770552
| 0.762577
| 0.762577
| 0.762577
| 0
| 0.073981
| 0.208754
| 5,552
| 78
| 1,102
| 71.179487
| 0.668108
| 0
| 0
| 0.180328
| 0
| 0.098361
| 0.892651
| 0.210735
| 0.04918
| 0
| 0
| 0
| 0
| 1
| 0.098361
| true
| 0
| 0.196721
| 0.081967
| 0.42623
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
c17e1d09a8a98b70030d2ac7bb2e78da6eb98d5c
| 11,195
|
py
|
Python
|
py/HW3/option_models/sabr.py
|
PanyuLi/ASP
|
cf8694217ab0d5d248a24770f317b6783a3b64a0
|
[
"MIT"
] | null | null | null |
py/HW3/option_models/sabr.py
|
PanyuLi/ASP
|
cf8694217ab0d5d248a24770f317b6783a3b64a0
|
[
"MIT"
] | null | null | null |
py/HW3/option_models/sabr.py
|
PanyuLi/ASP
|
cf8694217ab0d5d248a24770f317b6783a3b64a0
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 10
@author: jaehyuk
"""
import numpy as np
from . import normal
from . import bsm
import scipy.integrate as spint
import sys
sys.path.insert(sys.path.index('') + 1, 'C:/Users/cherr/Documents/GitHub/PyFeng')
import pyfeng as pf
'''
MC model class for Beta=1
'''
class ModelBsmMC:
beta = 1.0 # fixed (not used)
vov, rho = 0.0, 0.0
sigma, intr, divr = None, None, None
bsm_model = None
'''
You may define more members for MC: time step, etc
'''
def __init__(self, sigma, vov=0, rho=0.0, beta=1.0, intr=0, divr=0):
self.sigma = sigma
self.vov = vov
self.rho = rho
self.intr = intr
self.divr = divr
self.bsm_model = pf.Bsm(sigma, intr=intr, divr=divr)
def bsm_vol(self, strike, spot, texp=None, sigma=None):
''''
From the price from self.price() compute the implied vol
this is the opposite of bsm_vol in ModelHagan class
use bsm_model
'''
return 0
def price(self, strike, spot, texp=None, cp=1):
'''
Your MC routine goes here
Generate paths for vol and price first. Then get prices (vector) for all strikes
You may fix the random number seed
'''
dt = 0.01
n_time = int(texp // dt)
n_path = 10000
sigma_path = np.zeros((n_time+1, n_path))
sigma_path[0, :] = self.sigma
stock_path = np.zeros((n_time + 1, n_path))
stock_path[0, :] = spot
for i in range(n_time):
z1 = np.random.standard_normal(n_path)
x1 = np.random.standard_normal(n_path)
w1 = self.rho * z1 + np.sqrt(1 - self.rho ** 2) * x1
sigma_path[i+1, :] = sigma_path[i, :] * np.exp(self.vov * np.sqrt(dt) * z1 - 0.5 * self.vov ** 2 * dt)
stock_path[i+1, :] = stock_path[i, :] * np.exp(sigma_path[i, :] * np.sqrt(dt) * w1 - 0.5 * sigma_path[i, :] ** 2 * dt)
S_T = stock_path[-1, :]
price = []
std = []
for k in strike:
p = np.mean(np.fmax(S_T-k, 0))
price.append(p)
std.append(np.std(np.fmax(S_T-k, 0)))
# print("The standard deviation: \n", np.array(std))
return np.array(price)
def price0(self, strike, spot, texp=None, cp=1):
'''
Your MC routine goes here
Generate paths for vol and price first. Then get prices (vector) for all strikes
You may fix the random number seed
'''
m = pf.BsmNdMc(self.sigma, rn_seed=12345)
m.simulate(n_path=20000, tobs=[texp])
p = []
payoff = lambda x: np.fmax(np.mean(x, axis=1) - s, 0) # Basket option
for s in strike:
p.append(m.price_european(spot, texp, payoff))
return np.array(p)
'''
MC model class for Beta=0
'''
class ModelNormalMC:
beta = 0.0 # fixed (not used)
vov, rho = 0.0, 0.0
sigma, intr, divr = None, None, None
normal_model = None
def __init__(self, sigma, vov=0, rho=0.0, beta=0.0, intr=0, divr=0):
self.sigma = sigma
self.vov = vov
self.rho = rho
self.intr = intr
self.divr = divr
self.normal_model = pf.Norm(sigma, intr=intr, divr=divr)
def norm_vol(self, strike, spot, texp=None, sigma=None):
''''
From the price from self.price() compute the implied vol
this is the opposite of normal_vol in ModelNormalHagan class
use normal_model
'''
return 0
def price(self, strike, spot, texp=None, sigma=None, cp=1):
'''
Your MC routine goes here
Generate paths for vol and price first. Then get prices (vector) for all strikes
You may fix the random number seed
'''
dt = 0.01
n_time = int(texp // dt)
n_path = 10000
sigma_path = np.zeros((n_time + 1, n_path))
sigma_path[0, :] = self.sigma
stock_path = np.zeros((n_time + 1, n_path))
stock_path[0, :] = spot
for i in range(n_time):
z1 = np.random.standard_normal(n_path)
x1 = np.random.standard_normal(n_path)
w1 = self.rho * z1 + np.sqrt(1 - self.rho ** 2) * x1
sigma_path[i + 1, :] = sigma_path[i, :] * np.exp(self.vov * np.sqrt(dt) * z1 - 0.5 * self.vov ** 2 * dt)
stock_path[i + 1, :] = stock_path[i, :] + sigma_path[i, :] * w1 * np.sqrt(dt)
S_T = stock_path[-1, :]
price = []
std = []
for k in strike:
p = np.mean(np.fmax(S_T - k, 0))
price.append(p)
std.append(np.std(np.fmax(S_T - k, 0)))
# print("The standard deviation: \n", np.array(std))
return np.array(price)
def price0(self, strike, spot, texp=None, sigma=None, cp=1):
'''
Your MC routine goes here
Generate paths for vol and price first. Then get prices (vector) for all strikes
You may fix the random number seed
'''
m = pf.NormNdMc(self.sigma, rn_seed=12345)
m.simulate(n_path=20000, tobs=[texp])
p = []
payoff = lambda x: np.fmax(np.mean(x, axis=1) - s, 0) # Basket option
for s in strike:
p.append(m.price_european(spot, texp, payoff))
return np.array(p)
'''
Conditional MC model class for Beta=1
'''
class ModelBsmCondMC:
beta = 1.0 # fixed (not used)
vov, rho = 0.0, 0.0
sigma, intr, divr = None, None, None
bsm_model = None
'''
You may define more members for MC: time step, etc
'''
def __init__(self, sigma, vov=0, rho=0.0, beta=1.0, intr=0, divr=0):
self.sigma = sigma
self.vov = vov
self.rho = rho
self.intr = intr
self.divr = divr
self.bsm_model = pf.Bsm(sigma, intr=intr, divr=divr)
def bsm_vol(self, strike, spot, texp=None):
''''
From the price from self.price() compute the implied vol
this is the opposite of bsm_vol in ModelHagan class
use bsm_model
should be same as bsm_vol method in ModelBsmMC (just copy & paste)
'''
return 0
def price(self, strike, spot, texp=None, cp=1):
'''
Your MC routine goes here
Generate paths for vol only. Then compute integrated variance and normal price.
You may fix the random number seed
'''
# method 1
dt = 0.01
n_time = int(texp // dt)
n_path = 10000
sigma_path = np.zeros((n_time + 1, n_path))
sigma_path[0, :] = self.sigma
for i in range(n_time):
z1 = np.random.standard_normal(n_path)
sigma_path[i + 1, :] = sigma_path[i, :] * np.exp(self.vov * np.sqrt(dt) * z1 - 0.5 * self.vov ** 2 * dt)
sigma0 = sigma_path[0, :]
sigma_final = sigma_path[-1, :]
# int_var = np.mean(sigma_path ** 2, axis=0)
int_var = spint.simps(sigma_path ** 2, dx=1, axis=0) / 100
spot_mc = spot * np.exp(self.rho * (sigma_final - sigma0) / self.vov - 0.5 * self.rho ** 2 * int_var)
vol = np.sqrt((1 - self.rho ** 2) * int_var / texp)
price = []
for s in strike:
price.append(bsm.price(s, spot_mc, texp, vol, cp_sign=cp))
# print("The standard deviation: \n", np.std(price, axis=1))
return np.mean(price, axis=1)
def price0(self, strike, spot, texp=None, cp=1):
'''
Your MC routine goes here
Generate paths for vol only. Then compute integrated variance and BSM price.
Then get prices (vector) for all strikes
You may fix the random number seed
'''
# method 2
m = pf.BsmNdMc(self.vov, rn_seed=12345)
tobs = np.arange(0, 101) / 100 * texp
_ = m.simulate(tobs=tobs, n_path=1000)
sigma_path = np.squeeze(m.path) * self.sigma
sigma0 = sigma_path[0, :]
sigma_final = sigma_path[-1, :]
int_var = spint.simps(sigma_path ** 2, dx=1, axis=0) / 100
spot_mc = spot * np.exp(self.rho * (sigma_final - sigma0) / self.vov - 0.5 * self.rho ** 2 * int_var)
vol = np.sqrt((1 - self.rho ** 2) * int_var / texp)
price = []
for s in strike:
price.append(bsm.price(s, spot_mc, texp, vol, cp_sign=cp))
return np.mean(price, axis=1)
'''
Conditional MC model class for Beta=0
'''
class ModelNormalCondMC:
beta = 0.0 # fixed (not used)
vov, rho = 0.0, 0.0
sigma, intr, divr = None, None, None
normal_model = None
def __init__(self, sigma, vov=0, rho=0.0, beta=0.0, intr=0, divr=0):
self.sigma = sigma
self.vov = vov
self.rho = rho
self.intr = intr
self.divr = divr
self.normal_model = pf.Norm(sigma, intr=intr, divr=divr)
def norm_vol(self, strike, spot, texp=None):
''''
From the price from self.price() compute the implied vol
this is the opposite of normal_vol in ModelNormalHagan class
use normal_model
should be same as norm_vol method in ModelNormalMC (just copy & paste)
'''
return 0
def price(self, strike, spot, texp=None, cp=1):
'''
Your MC routine goes here
Generate paths for vol only. Then compute integrated variance and normal price.
You may fix the random number seed
'''
# method 1
dt = 0.01
n_time = int(texp // dt)
n_path = 10000
sigma_path = np.zeros((n_time + 1, n_path))
sigma_path[0, :] = self.sigma
for i in range(n_time):
z1 = np.random.standard_normal(n_path)
sigma_path[i + 1, :] = sigma_path[i, :] * np.exp(self.vov * np.sqrt(dt) * z1 - 0.5 * self.vov ** 2 * dt)
sigma0 = sigma_path[0, :]
sigma_final = sigma_path[-1, :]
# int_var = np.mean(sigma_path ** 2, axis=0)
int_var = spint.simps(sigma_path ** 2, dx=1, axis=0) / 100
spot_mc = spot + self.rho * (sigma_final - sigma0) / self.vov
vol = np.sqrt((1 - self.rho ** 2) * int_var / texp)
price = []
for s in strike:
price.append(normal.price(s, spot_mc, texp, vol, cp_sign=cp))
# print("The standard deviation: \n", np.std(price, axis=1))
return np.mean(price, axis=1)
def price0(self, strike, spot, texp=None, cp=1):
'''
Your MC routine goes here
Generate paths for vol only. Then compute integrated variance and normal price.
You may fix the random number seed
'''
# method 2
m = pf.NormNdMc(self.vov, rn_seed=12345)
tobs = np.arange(0, 101) / 100 * texp
_ = m.simulate(tobs=tobs, n_path=1000)
sigma_path = np.squeeze(m.path) * self.sigma
sigma0 = sigma_path[0, :]
sigma_final = sigma_path[-1, :]
int_var = spint.simps(sigma_path ** 2, dx=1, axis=0) / 100
spot_mc = spot + self.rho * (sigma_final - sigma0) / self.vov
vol = np.sqrt((1 - self.rho ** 2) * int_var / texp)
price = []
for s in strike:
price.append(normal.price(s, spot_mc, texp, vol, cp_sign=cp))
return np.mean(price, axis=1)
| 33.219585
| 130
| 0.560965
| 1,686
| 11,195
| 3.624555
| 0.097865
| 0.051546
| 0.027491
| 0.035346
| 0.935526
| 0.930944
| 0.927344
| 0.91098
| 0.91098
| 0.91098
| 0
| 0.038057
| 0.312282
| 11,195
| 336
| 131
| 33.318452
| 0.755683
| 0.208397
| 0
| 0.877005
| 0
| 0
| 0.004713
| 0.004713
| 0
| 0
| 0
| 0
| 0
| 1
| 0.085562
| false
| 0
| 0.032086
| 0
| 0.245989
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
c17e4ab4b6de7e402286c075a47f14ab29b7a20e
| 1,887
|
py
|
Python
|
tests/test_ospath.py
|
dgilland/ladder
|
393e3ef950cd6222175aa9a6833e51ee35a20f53
|
[
"MIT"
] | 3
|
2015-08-05T03:24:58.000Z
|
2018-09-03T19:48:27.000Z
|
tests/test_ospath.py
|
dgilland/ladder
|
393e3ef950cd6222175aa9a6833e51ee35a20f53
|
[
"MIT"
] | 1
|
2018-03-05T18:09:52.000Z
|
2018-03-05T18:09:52.000Z
|
tests/test_ospath.py
|
dgilland/ladder
|
393e3ef950cd6222175aa9a6833e51ee35a20f53
|
[
"MIT"
] | 1
|
2018-03-05T18:07:19.000Z
|
2018-03-05T18:07:19.000Z
|
from unittest import TestCase
from ladder import OSPath
class TestOSPath(TestCase):
def test_empty_path(self):
self.assertEqual(str(OSPath()), '')
def test_single_slash_path(self):
self.assertEqual(str(OSPath('/')), '/')
def test_initialized_path(self):
self.assertEqual(str(OSPath('/home/ladder')), '/home/ladder')
def test_chaining(self):
self.assertEqual(
str(OSPath().foo.bar(1, 'one').baz().qux),
'foo/bar/1/one/baz/qux')
def test_instance_regeneration(self):
path = OSPath('/foo')
original = str(path)
path()
self.assertEqual(str(path), original)
def test_add_operator_with_path(self):
path = OSPath('start/of/path') + OSPath('end/of/path')
self.assertTrue(isinstance(path, OSPath))
self.assertEqual(str(path), 'start/of/path/end/of/path')
def test_div_operator_with_path(self):
path = OSPath('start/of/path') / OSPath('end/of/path')
self.assertTrue(isinstance(path, OSPath))
self.assertEqual(str(path), 'start/of/path/end/of/path')
def test_add_operator_with_string(self):
path = OSPath('start/of/path') + 'end/of/path'
self.assertTrue(isinstance(path, OSPath))
self.assertEqual(str(path), 'start/of/path/end/of/path')
path = 'start/of/path' + OSPath('end/of/path')
self.assertTrue(isinstance(path, OSPath))
self.assertEqual(str(path), 'start/of/path/end/of/path')
def test_div_operator_with_string(self):
path = OSPath('start/of/path') / 'end/of/path'
self.assertTrue(isinstance(path, OSPath))
self.assertEqual(str(path), 'start/of/path/end/of/path')
path = 'start/of/path' / OSPath('end/of/path')
self.assertTrue(isinstance(path, OSPath))
self.assertEqual(str(path), 'start/of/path/end/of/path')
| 34.309091
| 69
| 0.63646
| 248
| 1,887
| 4.737903
| 0.157258
| 0.122553
| 0.11234
| 0.102128
| 0.801702
| 0.766809
| 0.71234
| 0.71234
| 0.645957
| 0.645957
| 0
| 0.00133
| 0.202968
| 1,887
| 54
| 70
| 34.944444
| 0.77992
| 0
| 0
| 0.3
| 0
| 0
| 0.184518
| 0.090668
| 0
| 0
| 0
| 0
| 0.425
| 1
| 0.225
| false
| 0
| 0.05
| 0
| 0.3
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
c1a9642c63d353965b77b77c9a34f942119f4052
| 4,861
|
py
|
Python
|
tests/index/test_index__scan.py
|
radiac/serac
|
61ac873aa53784a554fc44a799732f5d325a3f94
|
[
"BSD-3-Clause"
] | null | null | null |
tests/index/test_index__scan.py
|
radiac/serac
|
61ac873aa53784a554fc44a799732f5d325a3f94
|
[
"BSD-3-Clause"
] | null | null | null |
tests/index/test_index__scan.py
|
radiac/serac
|
61ac873aa53784a554fc44a799732f5d325a3f94
|
[
"BSD-3-Clause"
] | null | null | null |
"""
Test scan() in serac/index/index.py
"""
import os
from pathlib import Path
from serac.index.index import scan
from serac.index.models import File
from ..mocks import DatabaseTest, FilesystemTest, mock_file_archive
class TestIndexScan(DatabaseTest, FilesystemTest):
def test_single_dir__all_files_add(self, fs):
self.mock_fs(fs)
changeset = scan(includes=["/src/"])
assert len(changeset.added.keys()) == 5
assert Path("/src/one.txt") in changeset.added
assert Path("/src/two.txt") in changeset.added
assert Path("/src/dir/three.txt") in changeset.added
assert Path("/src/dir/four.txt") in changeset.added
assert Path("/src/dir/subdir/five.txt") in changeset.added
assert len(changeset.content.keys()) == 0
assert len(changeset.metadata.keys()) == 0
assert len(changeset.deleted.keys()) == 0
def test_glob_exclude__exclusions_not_listed(self, fs):
self.mock_fs(fs)
changeset = scan(includes=["/src"], excludes=["/src/dir/*.txt"])
assert len(changeset.added.keys()) == 2
assert Path("/src/one.txt") in changeset.added
assert Path("/src/two.txt") in changeset.added
def test_glob_and_exact_exclude__exclusions_not_listed(self, fs):
self.mock_fs(fs)
changeset = scan(includes=["/src"], excludes=["/src/one.txt", "/src/dir/*.txt"])
assert len(changeset.added.keys()) == 1
assert Path("/src/two.txt") in changeset.added
def test_path_exclude__exclusions_not_listed(self, fs):
self.mock_fs(fs)
changeset = scan(includes=["/src"], excludes=["*/subdir"])
assert len(changeset.added.keys()) == 4
assert Path("/src/one.txt") in changeset.added
assert Path("/src/two.txt") in changeset.added
assert Path("/src/dir/three.txt") in changeset.added
assert Path("/src/dir/four.txt") in changeset.added
def test_multiple_dir__all_collected(self, fs):
self.mock_fs(fs)
changeset = scan(includes=["/src", "/alt"])
assert len(changeset.added.keys()) == 7
assert Path("/src/one.txt") in changeset.added
assert Path("/src/two.txt") in changeset.added
assert Path("/src/dir/three.txt") in changeset.added
assert Path("/src/dir/four.txt") in changeset.added
assert Path("/src/dir/subdir/five.txt") in changeset.added
assert Path("/alt/six.txt") in changeset.added
assert Path("/alt/seven.txt") in changeset.added
def test_change_content(self, monkeypatch, fs):
self.mock_fs(fs)
monkeypatch.setattr(File, "archive", mock_file_archive)
changeset = scan(includes=["/src"])
changeset.commit(archive_config=self.get_archive_config())
Path("/src/one.txt").write_text("one updated")
Path("/src/dir/three.txt").write_text("three updated")
changeset = scan(includes=["/src"])
changeset.commit(archive_config=self.get_archive_config())
assert len(changeset.added.keys()) == 0
assert len(changeset.content.keys()) == 2
assert Path("/src/one.txt") in changeset.content
assert Path("/src/dir/three.txt") in changeset.content
assert len(changeset.metadata.keys()) == 0
assert len(changeset.deleted.keys()) == 0
def test_change_metadata(self, monkeypatch, fs):
self.mock_fs(fs)
monkeypatch.setattr(File, "archive", mock_file_archive)
changeset = scan(includes=["/src"])
changeset.commit(archive_config=self.get_archive_config())
Path("/src/one.txt").chmod(0o444)
os.chown("/src/dir/three.txt", 1, 1)
changeset = scan(includes=["/src"])
changeset.commit(archive_config=self.get_archive_config())
assert len(changeset.added.keys()) == 0
assert len(changeset.content.keys()) == 0
assert len(changeset.metadata.keys()) == 2
assert Path("/src/one.txt") in changeset.metadata
assert Path("/src/dir/three.txt") in changeset.metadata
assert len(changeset.deleted.keys()) == 0
def test_delete(self, monkeypatch, fs):
self.mock_fs(fs)
monkeypatch.setattr(File, "archive", mock_file_archive)
changeset = scan(includes=["/src"])
changeset.commit(archive_config=self.get_archive_config())
Path("/src/one.txt").unlink()
Path("/src/dir/three.txt").unlink()
changeset = scan(includes=["/src"])
changeset.commit(archive_config=self.get_archive_config())
assert len(changeset.added.keys()) == 0
assert len(changeset.content.keys()) == 0
assert len(changeset.metadata.keys()) == 0
assert len(changeset.deleted.keys()) == 2
assert Path("/src/one.txt") in changeset.deleted
assert Path("/src/dir/three.txt") in changeset.deleted
| 39.520325
| 88
| 0.645752
| 637
| 4,861
| 4.814757
| 0.122449
| 0.063906
| 0.114118
| 0.117705
| 0.855233
| 0.807304
| 0.796544
| 0.783828
| 0.716335
| 0.684382
| 0
| 0.006729
| 0.205102
| 4,861
| 122
| 89
| 39.844262
| 0.787008
| 0.0072
| 0
| 0.55914
| 0
| 0
| 0.126401
| 0.009963
| 0
| 0
| 0
| 0
| 0.483871
| 1
| 0.086022
| false
| 0
| 0.053763
| 0
| 0.150538
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
c1bd2e8c9d292297d8d26070cdaefce7edc60f76
| 3,013
|
py
|
Python
|
mysite/ViralScreener/models.py
|
memtech3/Viral-Screener
|
1940a7e097a9f5b7eb78f001c0a9623b398c020e
|
[
"MIT"
] | 1
|
2020-03-25T22:23:35.000Z
|
2020-03-25T22:23:35.000Z
|
mysite/ViralScreener/models.py
|
memtech3/Viral-Screener
|
1940a7e097a9f5b7eb78f001c0a9623b398c020e
|
[
"MIT"
] | 7
|
2020-03-23T04:51:55.000Z
|
2020-03-25T22:23:14.000Z
|
mysite/ViralScreener/models.py
|
memtech3/Viral-Screener
|
1940a7e097a9f5b7eb78f001c0a9623b398c020e
|
[
"MIT"
] | null | null | null |
from django.db import models
from django.conf import settings
from django.utils import timezone
# Create your models here.
class AlertMessage(models.Model):
name = models.CharField(max_length=200)
color = models.CharField(max_length=200, choices=[('success', 'green'), ('primary', 'blue'), ('warning', 'yellow'), ('danger', 'red'),])
content = models.TextField()
dismissable = models.BooleanField()
def __str__(self):
return self.name
class HomeMessages(models.Model):
name = models.CharField(max_length=200)
header = models.CharField(max_length=200)
content = models.TextField()
class Employee(models.Model):
id = models.AutoField(primary_key=True),
LastName = models.CharField(max_length=200)
FirstName = models.CharField(max_length=200)
MiddleName = models.CharField(max_length=200, blank=True)
EmployeeID = models.CharField(max_length=200, blank=True)
models.UniqueConstraint(fields=['FirstName', 'MiddleName', 'LastName'], name='unique_person')
readonly_fields = ('id',)
def __str__(self):
return " ".join((self.LastName, self.FirstName, self.MiddleName))
class Visitor(models.Model):
id = models.AutoField(primary_key=True),
LastName = models.CharField(max_length=200)
FirstName = models.CharField(max_length=200)
MiddleName = models.CharField(max_length=200, blank=True)
models.UniqueConstraint(fields=['FirstName', 'MiddleName', 'LastName'], name='unique_person')
readonly_fields = ('id',)
def __str__(self):
return " ".join((self.LastName, self.FirstName, self.MiddleName))
class EmployeeScreeningResponse(models.Model):#waiting for questions to ask
id = models.AutoField(primary_key=True),
Screener = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
)
Employee = models.ForeignKey(Employee, on_delete=models.CASCADE)
Symptoms = models.CharField(max_length=200, choices=[('y', 'Yes'), ('n', 'No'), ('u', 'Unknown')])
Contact = models.CharField(max_length=200, choices=[('y', 'Yes'), ('n', 'No'), ('u', 'Unknown')])
ElevatedTemp = models.CharField(max_length=200, choices=[('y', 'Yes'), ('n', 'No'), ('u', 'Unknown')])
DateTime = models.DateTimeField()
def __str__(self):
return ('R'+str(self.id))
class VisitorScreeningResponse(models.Model):#waiting for questions to ask
id = models.AutoField(primary_key=True),
Screener = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
)
Visitor = models.ForeignKey(Visitor, on_delete=models.CASCADE)
Symptoms = models.CharField(max_length=200, choices=[('y', 'Yes'), ('n', 'No'), ('u', 'Unknown')])
Contact = models.CharField(max_length=200, choices=[('y', 'Yes'), ('n', 'No'), ('u', 'Unknown')])
ElevatedTemp = models.CharField(max_length=200, choices=[('y', 'Yes'), ('n', 'No'), ('u', 'Unknown')])
DateTime = models.DateTimeField()
def __str__(self):
return ('R'+str(self.id))
| 44.308824
| 140
| 0.679721
| 357
| 3,013
| 5.588235
| 0.232493
| 0.12782
| 0.153383
| 0.204511
| 0.782456
| 0.768922
| 0.75188
| 0.75188
| 0.709774
| 0.709774
| 0
| 0.020016
| 0.154331
| 3,013
| 68
| 141
| 44.308824
| 0.762951
| 0.026552
| 0
| 0.694915
| 0
| 0
| 0.076109
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.084746
| false
| 0
| 0.050847
| 0.084746
| 0.864407
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 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
| 0
| 0
| 0
| 1
| 0
|
0
| 7
|
c1d172ba99eff34e577f914c7b73d2768fe92720
| 2,200
|
py
|
Python
|
pybot/whatsapp/util/WaitUtil.py
|
iren86/whatsapp-pybot
|
28f0d855f53090cb9a0c88bdbca29f6f93efc95e
|
[
"MIT"
] | 4
|
2017-08-15T10:04:11.000Z
|
2019-09-01T08:28:42.000Z
|
pybot/whatsapp/util/WaitUtil.py
|
iren86/whatsapp-pybot
|
28f0d855f53090cb9a0c88bdbca29f6f93efc95e
|
[
"MIT"
] | null | null | null |
pybot/whatsapp/util/WaitUtil.py
|
iren86/whatsapp-pybot
|
28f0d855f53090cb9a0c88bdbca29f6f93efc95e
|
[
"MIT"
] | 2
|
2019-08-27T19:14:03.000Z
|
2019-10-12T21:50:03.000Z
|
# -*- coding: utf-8 -*-
import time
from pybot.whatsapp.core.LoggerFactory import get_logger
POLL_FREQUENCY = 0.5
# message will be posted every POLL_FREQUENCY * POST_WAIT_MSG_EVERY_ITERATION second
POST_WAIT_MSG_EVERY_ITERATION = 10
logger = get_logger()
def wait_for_result(method, timeout, wait_msg=None):
"""Calls the method until the return value is True."""
count = 0
result = None
end_time = time.time() + timeout
while True:
try:
result = method()
if result:
return result
except:
pass
time.sleep(POLL_FREQUENCY)
if time.time() > end_time:
break
if wait_msg and count % POST_WAIT_MSG_EVERY_ITERATION == 0:
logger.warning(
"%s\n... Stop waiting in %s sec. ..." % (wait_msg, int(end_time - time.time())))
count += 1
return result
def wait_for_result_is_none(method, timeout, wait_msg=None):
"""Calls the method until the return value is None."""
count = 0
end_time = time.time() + timeout
while True:
try:
result = method()
if result is None:
return True
except:
pass
time.sleep(POLL_FREQUENCY)
if time.time() > end_time:
break
if wait_msg and count % POST_WAIT_MSG_EVERY_ITERATION == 0:
logger.warning(
"%s\n... Stop waiting in %s sec. ..." % (wait_msg, int(end_time - time.time())))
count += 1
return False
def wait_for_result_is_false(method, timeout, wait_msg=None):
"""Calls the method until the return value is False."""
count = 0
end_time = time.time() + timeout
while True:
try:
result = method()
if not result:
return True
except:
pass
time.sleep(POLL_FREQUENCY)
if time.time() > end_time:
break
if wait_msg and count % POST_WAIT_MSG_EVERY_ITERATION == 0:
logger.warning(
"%s\n... Stop waiting in %s sec. ..." % (wait_msg, int(end_time - time.time())))
count += 1
return False
| 24.444444
| 96
| 0.565909
| 279
| 2,200
| 4.265233
| 0.218638
| 0.10084
| 0.055462
| 0.07563
| 0.805882
| 0.733613
| 0.733613
| 0.733613
| 0.733613
| 0.733613
| 0
| 0.009582
| 0.335909
| 2,200
| 89
| 97
| 24.719101
| 0.804928
| 0.115
| 0
| 0.8
| 0
| 0
| 0.054404
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.05
| false
| 0.05
| 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
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
a9bf9edc8e638f330662df094722c79a41e1d026
| 3,546
|
py
|
Python
|
ecs/tasks/migrations/0010_distinct_names.py
|
programmierfabrik/ecs
|
2389a19453e21b2ea4e40b272552bcbd42b926a9
|
[
"Apache-2.0"
] | 9
|
2017-02-13T18:17:13.000Z
|
2020-11-21T20:15:54.000Z
|
ecs/tasks/migrations/0010_distinct_names.py
|
programmierfabrik/ecs
|
2389a19453e21b2ea4e40b272552bcbd42b926a9
|
[
"Apache-2.0"
] | 2
|
2021-05-20T14:26:47.000Z
|
2021-05-20T14:26:48.000Z
|
ecs/tasks/migrations/0010_distinct_names.py
|
programmierfabrik/ecs
|
2389a19453e21b2ea4e40b272552bcbd42b926a9
|
[
"Apache-2.0"
] | 4
|
2017-04-02T18:48:59.000Z
|
2021-11-23T15:40:35.000Z
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0009_task_review_for'),
]
operations = [
migrations.RunSQL('''
with n as (
update workflow_node
set name = 'Initial Amendment Review'
where uid = 'initial_amendment_review'
returning id
)
update tasks_tasktype
set name = 'Initial Amendment Review'
from n
where workflow_node_id = n.id;
with n as (
update workflow_node
set name = 'Initial Thesis Review'
where uid = 'initial_thesis_review'
returning id
)
update tasks_tasktype
set name = 'Initial Thesis Review'
from n
where workflow_node_id = n.id;
with n as (
update workflow_node
set name = 'Office Notification Review'
where uid = 'office_report_review'
returning id
)
update tasks_tasktype
set name = 'Office Notification Review'
from n
where workflow_node_id = n.id;
with n as (
update workflow_node
set name = 'Executive Notification Review'
where uid = 'executive_report_review'
returning id
)
update tasks_tasktype
set name = 'Executive Notification Review'
from n
where workflow_node_id = n.id;
with n as (
update workflow_node
set name = 'Office Vote Review (legacy)'
where uid = 'office_vote_review'
returning id
)
update tasks_tasktype
set name = 'Office Vote Review (legacy)'
from n
where workflow_node_id = n.id;
with n as (
update workflow_node
set name = 'Insurance Amendment Review'
where uid = 'insurance_group_review'
returning id
)
update tasks_tasktype
set name = 'Insurance Amendment Review'
from n
where workflow_node_id = n.id;
with n as (
update workflow_node
set name = 'Insurance B2 Resubmission Review'
where uid = 'insurance_b2_review'
returning id
)
update tasks_tasktype
set name = 'Insurance B2 Resubmission Review'
from n
where workflow_node_id = n.id;
with n as (
update workflow_node
set name = 'Office B2 Resubmission Review'
where uid = 'b2_review'
returning id
)
update tasks_tasktype
set name = 'Office B2 Resubmission Review'
from n
where workflow_node_id = n.id;
with n as (
update workflow_node
set name = 'Executive B2 Resubmission Review'
where uid = 'executive_b2_review'
returning id
)
update tasks_tasktype
set name = 'Executive B2 Resubmission Review'
from n
where workflow_node_id = n.id;
'''),
]
| 30.834783
| 61
| 0.498308
| 340
| 3,546
| 5.017647
| 0.141176
| 0.126612
| 0.036928
| 0.068581
| 0.822978
| 0.759672
| 0.705744
| 0.705744
| 0.705744
| 0.401524
| 0
| 0.007231
| 0.454033
| 3,546
| 114
| 62
| 31.105263
| 0.873967
| 0.005922
| 0
| 0.72
| 0
| 0
| 0.934431
| 0.045984
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.02
| 0
| 0.05
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
e704f06d325d5dcd5aacd677496df9c60e4fe384
| 47
|
py
|
Python
|
backend/app/views/analyze_digests/__init__.py
|
Edinburgh-Genome-Foundry/CUBA
|
d57565951ead619ef9263e8b356b451001fb910f
|
[
"MIT"
] | 15
|
2018-02-12T13:12:13.000Z
|
2021-08-15T11:37:59.000Z
|
backend/app/views/analyze_digests/__init__.py
|
Edinburgh-Genome-Foundry/CUBA
|
d57565951ead619ef9263e8b356b451001fb910f
|
[
"MIT"
] | 9
|
2020-06-05T17:54:54.000Z
|
2022-02-12T12:03:19.000Z
|
backend/app/views/analyze_digests/__init__.py
|
Edinburgh-Genome-Foundry/CUBA
|
d57565951ead619ef9263e8b356b451001fb910f
|
[
"MIT"
] | 3
|
2018-10-18T13:08:50.000Z
|
2020-08-17T14:09:46.000Z
|
from .AnalyzeDigests import AnalyzeDigestsView
| 23.5
| 46
| 0.893617
| 4
| 47
| 10.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.085106
| 47
| 1
| 47
| 47
| 0.976744
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 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
| 7
|
e7637aaafc574d9fe13298f9e3e8e5bb68c542aa
| 124
|
py
|
Python
|
platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/viper/calculators/calc_ber.py
|
PascalGuenther/gecko_sdk
|
2e82050dc8823c9fe0e8908c1b2666fb83056230
|
[
"Zlib"
] | 82
|
2016-06-29T17:24:43.000Z
|
2021-04-16T06:49:17.000Z
|
platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/viper/calculators/calc_ber.py
|
PascalGuenther/gecko_sdk
|
2e82050dc8823c9fe0e8908c1b2666fb83056230
|
[
"Zlib"
] | 6
|
2022-01-12T18:22:08.000Z
|
2022-03-25T10:19:27.000Z
|
platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/viper/calculators/calc_ber.py
|
PascalGuenther/gecko_sdk
|
2e82050dc8823c9fe0e8908c1b2666fb83056230
|
[
"Zlib"
] | 56
|
2016-08-02T10:50:50.000Z
|
2021-07-19T08:57:34.000Z
|
from pyradioconfig.parts.bobcat.calculators.calc_ber import Calc_BER_Bobcat
class calc_ber_viper(Calc_BER_Bobcat):
pass
| 31
| 75
| 0.854839
| 19
| 124
| 5.210526
| 0.578947
| 0.282828
| 0.262626
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.08871
| 124
| 4
| 76
| 31
| 0.876106
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.333333
| 0.333333
| 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
| 1
| 1
| 1
| 0
| 0
| 0
|
0
| 7
|
99c8729dd19d7fa5f0661ffa4bfe98f31f3d26f0
| 14,964
|
py
|
Python
|
BookClub/tests/views/action_views/test_join_club_view.py
|
amir-rahim/BookClubSocialNetwork
|
b69a07cd33592f700214252a64c7c1c53845625d
|
[
"MIT"
] | 4
|
2022-02-04T02:11:48.000Z
|
2022-03-12T21:38:01.000Z
|
BookClub/tests/views/action_views/test_join_club_view.py
|
amir-rahim/BookClubSocialNetwork
|
b69a07cd33592f700214252a64c7c1c53845625d
|
[
"MIT"
] | 51
|
2022-02-01T18:56:23.000Z
|
2022-03-31T15:35:37.000Z
|
BookClub/tests/views/action_views/test_join_club_view.py
|
amir-rahim/BookClubSocialNetwork
|
b69a07cd33592f700214252a64c7c1c53845625d
|
[
"MIT"
] | null | null | null |
"""Unit Testing of the Join Club view."""
from django.contrib import messages
from django.core.exceptions import ObjectDoesNotExist
from django.test import TestCase, tag
from django.urls import reverse
from BookClub.models import User, Club, ClubMembership
from BookClub.tests.helpers import LogInTester
@tag("views", "action_views", "join_club")
class JoinClubViewTestCase(TestCase, LogInTester):
"""Join Club view testing"""
fixtures = [
'BookClub/tests/fixtures/default_users.json',
'BookClub/tests/fixtures/default_clubs.json',
]
def setUp(self):
self.user = User.objects.get(username="johndoe")
self.public_club = Club.objects.get(pk="1")
self.private_club = Club.objects.get(pk="3")
self.url = reverse('join_club', kwargs={'club_url_name': self.public_club.club_url_name})
def test_url(self):
self.assertEqual(self.url, f'/join_club/{self.public_club.club_url_name}/')
def test_redirect_when_not_logged_in(self):
self.assertFalse(self._is_logged_in())
response = self.client.get(self.url)
self.assertEqual(response.status_code, 302)
def test_get_join_club_redirects_to_available_clubs(self):
"""Test for redirecting user to available_clubs when used get method."""
self.client.login(username=self.user.username, password='Password123')
self.assertTrue(self._is_logged_in())
response = self.client.get(reverse('join_club', kwargs={'club_url_name': self.public_club.club_url_name}))
redirect_url = reverse('available_clubs')
self.assertRedirects(response, redirect_url, status_code=302, target_status_code=200)
# Tests for user joining and applying to private and public clubs
def test_user_applies_to_private_club(self):
self.client.login(username=self.user.username, password='Password123')
before_count = ClubMembership.objects.count()
response = self.client.post(reverse('join_club', kwargs={'club_url_name': self.private_club.club_url_name}))
after_count = ClubMembership.objects.count()
self.assertEqual(before_count, after_count - 1)
self.assertTrue(ClubMembership.objects.filter(user=self.user, club=self.private_club,
membership=ClubMembership.UserRoles.APPLICANT).exists())
# test appropriate message
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.SUCCESS)
def test_user_joins_public_club(self):
self.client.login(username=self.user.username, password='Password123')
before_count = ClubMembership.objects.count()
response = self.client.post(self.url)
after_count = ClubMembership.objects.count()
self.assertEqual(before_count, after_count - 1)
self.assertTrue(ClubMembership.objects.filter(user=self.user, club=self.public_club,
membership=ClubMembership.UserRoles.MEMBER).exists())
# test appropriate message
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.SUCCESS)
def test_user_action_invalid_club(self):
self.client.login(username=self.user.username, password='Password123')
response = self.client.post(reverse('join_club', kwargs={'club_url_name': "wrong"}))
with self.assertRaises(ObjectDoesNotExist):
Club.objects.get(club_url_name="wrong").exists()
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.ERROR)
def test_applicant_applies_to_private_club(self):
self.client.login(username=self.user.username, password='Password123')
membership = ClubMembership.objects.create(user=self.user, club=self.private_club,
membership=ClubMembership.UserRoles.APPLICANT)
membership.save()
before_count = ClubMembership.objects.count()
response = self.client.post(reverse('join_club', kwargs={'club_url_name': self.private_club.club_url_name}))
after_count = ClubMembership.objects.count()
self.assertEqual(before_count, after_count)
self.assertTrue(ClubMembership.objects.filter(user=self.user, club=self.private_club,
membership=ClubMembership.UserRoles.APPLICANT).exists())
# test appropriate message
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.INFO)
def test_applicant_joins_public_club(self):
self.client.login(username=self.user.username, password='Password123')
membership = ClubMembership.objects.create(user=self.user, club=self.public_club,
membership=ClubMembership.UserRoles.APPLICANT)
membership.save()
before_count = ClubMembership.objects.count()
response = self.client.post(self.url)
after_count = ClubMembership.objects.count()
self.assertEqual(before_count, after_count)
self.assertTrue(ClubMembership.objects.filter(user=self.user, club=self.public_club,
membership=ClubMembership.UserRoles.APPLICANT).exists())
# test appropriate message
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.INFO)
def test_applicant_action_invalid_club(self):
self.client.login(username=self.user.username, password='Password123')
response = self.client.post(reverse('join_club', kwargs={'club_url_name': "wrong"}))
with self.assertRaises(ObjectDoesNotExist):
Club.objects.get(club_url_name="wrong").exists()
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.ERROR)
def test_member_applies_to_private_club(self):
self.client.login(username=self.user.username, password='Password123')
membership = ClubMembership.objects.create(user=self.user, club=self.private_club,
membership=ClubMembership.UserRoles.APPLICANT)
membership.save()
before_count = ClubMembership.objects.count()
response = self.client.post(reverse('join_club', kwargs={'club_url_name': self.private_club.club_url_name}))
after_count = ClubMembership.objects.count()
self.assertEqual(before_count, after_count)
self.assertTrue(ClubMembership.objects.filter(user=self.user, club=self.private_club,
membership=ClubMembership.UserRoles.APPLICANT).exists())
# test appropriate message
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.INFO)
def test_member_joins_public_club(self):
self.client.login(username=self.user.username, password='Password123')
membership = ClubMembership.objects.create(user=self.user, club=self.public_club,
membership=ClubMembership.UserRoles.MEMBER)
membership.save()
before_count = ClubMembership.objects.count()
response = self.client.post(self.url)
after_count = ClubMembership.objects.count()
self.assertEqual(before_count, after_count)
self.assertTrue(ClubMembership.objects.filter(user=self.user, club=self.public_club,
membership=ClubMembership.UserRoles.MEMBER).exists())
# test appropriate message
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.INFO)
def test_member_action_invalid_club(self):
self.client.login(username=self.user.username, password='Password123')
response = self.client.post(reverse('join_club', kwargs={'club_url_name': "wrong"}))
with self.assertRaises(ObjectDoesNotExist):
Club.objects.get(club_url_name="wrong").exists()
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.ERROR)
def test_moderator_applies_to_private_club(self):
self.client.login(username=self.user.username, password='Password123')
membership = ClubMembership.objects.create(user=self.user, club=self.private_club,
membership=ClubMembership.UserRoles.MODERATOR)
membership.save()
before_count = ClubMembership.objects.count()
response = self.client.post(reverse('join_club', kwargs={'club_url_name': self.private_club.club_url_name}))
after_count = ClubMembership.objects.count()
self.assertEqual(before_count, after_count)
self.assertTrue(ClubMembership.objects.filter(user=self.user, club=self.private_club,
membership=ClubMembership.UserRoles.MODERATOR).exists())
# test appropriate message
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.INFO)
def test_moderator_joins_public_club(self):
self.client.login(username=self.user.username, password='Password123')
membership = ClubMembership.objects.create(user=self.user, club=self.public_club,
membership=ClubMembership.UserRoles.MODERATOR)
membership.save()
before_count = ClubMembership.objects.count()
response = self.client.post(self.url)
after_count = ClubMembership.objects.count()
self.assertEqual(before_count, after_count)
self.assertTrue(ClubMembership.objects.filter(user=self.user, club=self.public_club,
membership=ClubMembership.UserRoles.MODERATOR).exists())
# test appropriate message
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.INFO)
def test_moderator_action_invalid_club(self):
self.client.login(username=self.user.username, password='Password123')
response = self.client.post(reverse('join_club', kwargs={'club_url_name': "wrong"}))
with self.assertRaises(ObjectDoesNotExist):
Club.objects.get(club_url_name="wrong").exists()
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.ERROR)
def test_owner_applies_to_private_club(self):
self.client.login(username=self.user.username, password='Password123')
membership = ClubMembership.objects.create(user=self.user, club=self.private_club,
membership=ClubMembership.UserRoles.OWNER)
membership.save()
before_count = ClubMembership.objects.count()
response = self.client.post(reverse('join_club', kwargs={'club_url_name': self.private_club.club_url_name}))
after_count = ClubMembership.objects.count()
self.assertEqual(before_count, after_count)
self.assertTrue(ClubMembership.objects.filter(user=self.user, club=self.private_club,
membership=ClubMembership.UserRoles.OWNER).exists())
# test appropriate message
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.INFO)
def test_owner_joins_public_club(self):
self.client.login(username=self.user.username, password='Password123')
membership = ClubMembership.objects.create(user=self.user, club=self.public_club,
membership=ClubMembership.UserRoles.OWNER)
membership.save()
before_count = ClubMembership.objects.count()
response = self.client.post(self.url)
after_count = ClubMembership.objects.count()
self.assertEqual(before_count, after_count)
self.assertTrue(ClubMembership.objects.filter(user=self.user, club=self.public_club,
membership=ClubMembership.UserRoles.OWNER).exists())
# test appropriate message
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.INFO)
def test_owner_action_invalid_club(self):
self.client.login(username=self.user.username, password='Password123')
response = self.client.post(reverse('join_club', kwargs={'club_url_name': "wrong"}))
with self.assertRaises(ObjectDoesNotExist):
Club.objects.get(club_url_name="wrong").exists()
response_message = self.client.get(reverse('available_clubs'))
messages_list = list(response_message.context['messages'])
self.assertEqual(len(messages_list), 1)
self.assertEqual(messages_list[0].level, messages.ERROR)
| 58.225681
| 116
| 0.680634
| 1,647
| 14,964
| 5.9915
| 0.068002
| 0.048642
| 0.027868
| 0.062829
| 0.905047
| 0.900993
| 0.900993
| 0.900993
| 0.889947
| 0.88407
| 0
| 0.007702
| 0.210438
| 14,964
| 256
| 117
| 58.453125
| 0.827507
| 0.029404
| 0
| 0.798165
| 0
| 0
| 0.069872
| 0.008829
| 0
| 0
| 0
| 0
| 0.275229
| 1
| 0.087156
| false
| 0.073395
| 0.027523
| 0
| 0.123853
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 8
|
4171cc573a219efb4c66383c0e807efee309c6d1
| 180
|
py
|
Python
|
Python/Category/builtins.py
|
wurui1994/test
|
027cef75f98dbb252b322113dacd4a9a6997d84f
|
[
"MIT"
] | 27
|
2017-12-19T09:15:36.000Z
|
2021-07-30T13:02:00.000Z
|
Python/Category/builtins.py
|
wurui1994/test
|
027cef75f98dbb252b322113dacd4a9a6997d84f
|
[
"MIT"
] | null | null | null |
Python/Category/builtins.py
|
wurui1994/test
|
027cef75f98dbb252b322113dacd4a9a6997d84f
|
[
"MIT"
] | 29
|
2018-04-10T13:25:54.000Z
|
2021-12-24T01:51:03.000Z
|
# print([callable(getattr(__builtins__, attr)) for attr in dir(__builtins__)])
print([(attr,type(getattr(__builtins__, attr))) for attr in dir(__builtins__)])
# print 'hello'*100
| 36
| 79
| 0.738889
| 24
| 180
| 4.875
| 0.458333
| 0.25641
| 0.324786
| 0.376068
| 0.752137
| 0.752137
| 0.752137
| 0.752137
| 0.752137
| 0
| 0
| 0.018405
| 0.094444
| 180
| 4
| 80
| 45
| 0.699387
| 0.522222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 1
| 1
| 1
| 1
| 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
| 11
|
68fac8d2f86ab04b3685489b6b71aca1265871fb
| 35,910
|
py
|
Python
|
models/ModelSet.py
|
mourmoerl/med_segmentation
|
36b757253f92a862d195549d2ebbb1f3ca3a4469
|
[
"Apache-2.0"
] | null | null | null |
models/ModelSet.py
|
mourmoerl/med_segmentation
|
36b757253f92a862d195549d2ebbb1f3ca3a4469
|
[
"Apache-2.0"
] | null | null | null |
models/ModelSet.py
|
mourmoerl/med_segmentation
|
36b757253f92a862d195549d2ebbb1f3ca3a4469
|
[
"Apache-2.0"
] | null | null | null |
import tensorflow as tf
from tensorflow.keras.layers import *
import tensorflow.keras.backend as K
from tensorflow.keras.utils import multi_gpu_model
from .blocks import *
# from .loss_Function import *
import models.loss_function as loss_function
from .metrics import *
from util import convert_tf_optimizer
import copy
class ModelSet:
"""
Model set which contains the network models
"""
"""
=== network models
"""
# Merge-And-Run Mapping network
def model_MRGE(self, config):
conv_param_global = config['convolution_parameter']
conv_param_local = copy.deepcopy(conv_param_global)
conv_param_local['dilation_rate'] = 1
in_pos = None
filters = config['filters']
input_shape = (*config['patch_size'],) + (config['channel_img_num'],)
inputs = tf.keras.Input(shape=input_shape, name='inp1')
shortcuts = []
x = inputs
# maximum dilation rate in each stage
list_max_dilate_rate = [8, 4, 2, 1, 1]
for l in list_max_dilate_rate:
x, y = MR_block_split(filters, conv_param_local)(x)
block_num = int(log2(l) + 1)
rate_list = [2 ** i for i in range(block_num)]
for rate in rate_list[:-1]:
conv_param_global['dilation_rate'] = rate
x, y = MR_GE_block(filters, conv_param_local,conv_param_global)(x, y)
conv_param_global['dilation_rate'] = rate_list[-1]
x = MR_GE_block_merge(filters, conv_param_local,conv_param_global)(x, y)
shortcuts.append(x)
x = MaxPool3D()(x)
filters = int(2 * filters)
filters = int(x.shape[-1])
x = block(filters, 1, 1, order=['c'], order_param=[conv_param_local])(x)
if config['feed_pos']:
in_pos = Input(shape=(3,), name='input_position')
pos = Reshape(target_shape=(1, 1, 1, 3))(in_pos)
if config['pos_noise_stdv'] != 0:
pos = GaussianNoise(config['pos_noise_stdv'])(pos)
pos = BatchNormalization()(pos)
pos = UpSampling3D(size=x.shape[1:4])(pos)
x = Concatenate(axis=-1)([x, pos])
for l, shortcut in reversed(list(zip(list_max_dilate_rate, shortcuts))):
x = block(filters, 3, 2, order=['dc'], order_param=[conv_param_local])(x)
x = Add()([shortcut, x])
filters = int(filters // 2)
x, y = MR_block_split(filters, conv_param_local)(x)
rate_list = [2 ** i for i in range(int(log2(l) + 1))]
for rate in rate_list[:-1]:
conv_param_global['dilation_rate'] = rate
x, y = MR_GE_block(filters, conv_param_local,conv_param_global)(x, y)
conv_param_global['dilation_rate'] = rate_list[-1]
x = MR_GE_block_merge(filters, conv_param_local,conv_param_global)(x, y)
x = block(config['channel_label_num'], 1, 1, order=['b', 'r', 'c'], order_param=[None, None, conv_param_local])(x)
out = Activation('softmax', name='output_Y')(x)
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], out, config)
else:
return create_and_compile_model(inputs, out, config)
# Merge-And-Run network with
def model_MRGE_1(self, config):
"""An Alternative structure of MRGE, Simplify the MRGE block to a new block similar to ResNet"""
conv_param_global = config['convolution_parameter']
conv_param_local = copy.deepcopy(conv_param_global)
conv_param_local['dilation_rate'] = 1
in_pos = None
filters = config['filters']
input_shape = (*config['patch_size'],) + (config['channel_img_num'],)
inputs = tf.keras.Input(shape=input_shape, name='inp1')
shortcuts = []
x = inputs
# maximum dilation rate in each stage
list_max_dilate_rate = [8, 4, 2, 1, 1]
for max_dilate_rate in list_max_dilate_rate:
dilate_rate = [2 ** i for i in range(int(log2(max_dilate_rate)) + 1)]
x_list = [x]
for rate in dilate_rate:
conv_param_global['dilation_rate'] = rate
x = block(filters, 3, 1, order=['c', 'r', 'b'], order_param=[conv_param_global, None, None])(x)
x_list.append(x)
x = tf.concat(x_list, axis=-1)
x = block(filters, 3, 1, order=['c', 'r', 'b'], order_param=[conv_param_local, None, None])(x)
shortcuts.append(x)
x = MaxPool3D()(x)
filters = int(2 * filters)
filters = int(x.shape[-1])
if config['feed_pos']:
in_pos = Input(shape=(3,), name='input_position')
pos = Reshape(target_shape=(1, 1, 1, 3))(in_pos)
if config['pos_noise_stdv'] != 0:
pos = GaussianNoise(config['pos_noise_stdv'])(pos)
pos = BatchNormalization()(pos)
pos = UpSampling3D(size=x.shape[1:4])(pos)
x = Concatenate(axis=-1)([x, pos])
x = block(filters * 4, 1, 1, order=['c', 'b', 'r'], order_param=[conv_param_local, None, None])(x)
x = block(filters, 1, 1, order=['c', 'b', 'r'], order_param=[conv_param_local, None, None])(x)
x = block(filters, 3, 2, order=['dc'], order_param=[conv_param_local])(x)
for index_, (max_dilate_rate, shortcut) in enumerate(reversed(list(zip(list_max_dilate_rate, shortcuts)))):
x = Add()([shortcut, x])
filters = int(filters // 2)
dilate_rate = [2 ** i for i in range(int(log2(max_dilate_rate)) + 1)]
x_list = [x]
for rate in dilate_rate:
conv_param_global['dilation_rate'] = rate
x = block(filters, 3, 1, order=['c', 'r', 'b'], order_param=[conv_param_global, None, None])(x)
x_list.append(x)
x = tf.concat(x_list, axis=-1)
if index_ < len(list_max_dilate_rate) - 1:
x = block(filters, 3, 2, order=['dc', 'r', 'b'], order_param=[conv_param_local, None, None])(x)
x = block(filters, 3, 1, order=['c', 'r', 'b'], order_param=[conv_param_local, None, None])(x)
out = block(config['channel_label_num'], 1, 1, order=['c', 'b', 's'], order_param=[conv_param_local, None, None])(x)
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], out, config)
else:
return create_and_compile_model(inputs, out, config)
def model_MRGE_2(self, config):
"Experimental"
conv_param_global = config['convolution_parameter']
conv_param_local = copy.deepcopy(conv_param_global)
conv_param_local['dilation_rate'] = 1
in_pos = None
b_f=config['filters']
filters = [b_f, int(b_f*1.5), b_f*2, b_f*32, b_f*64]
input_shape = (*config['patch_size'],) + (config['channel_img_num'],)
inputs = tf.keras.Input(shape=input_shape, name='inp1')
shortcuts = []
x = inputs
# maximum dilation rate in each stage
list_max_dilate_rate = [16, 8, 4, 2, 1]
for index_, max_dilate_rate in enumerate(list_max_dilate_rate):
dilate_rate = [2 ** i for i in range(int(log2(max_dilate_rate)) + 1)]
x_list = [x]
for rate in dilate_rate:
conv_param_global['dilation_rate'] = rate
x = block(filters[index_], 3, 1, order=['c', 'r', 'b'], order_param=[conv_param_global, None, None])(x)
x_list.append(x)
x = tf.concat(x_list, axis=-1)
x = block(filters[index_], 3, 1, order=['c', 'r', 'b'], order_param=[conv_param_local, None, None])(x)
shortcuts.append(x)
x = MaxPool3D()(x)
filter = int(x.shape[-1])
if config['feed_pos']:
in_pos = Input(shape=(3,), name='input_position')
pos = Reshape(target_shape=(1, 1, 1, 3))(in_pos)
if config['pos_noise_stdv'] != 0:
pos = GaussianNoise(config['pos_noise_stdv'])(pos)
pos = BatchNormalization()(pos)
pos = UpSampling3D(size=x.shape[1:4])(pos)
x = Concatenate(axis=-1)([x, pos])
x = block(filter * 4, 1, 1, order=['c', 'b', 'r'], order_param=[conv_param_local, None, None])(x)
x = block(filter, 1, 1, order=['c', 'b', 'r'], order_param=[conv_param_local, None, None])(x)
x = block(filter, 3, 2, order=['dc'], order_param=[conv_param_local])(x)
for index_, (max_dilate_rate, shortcut) in enumerate(reversed(list(zip(list_max_dilate_rate, shortcuts)))):
x = tf.concat([shortcut, x],axis=-1)
k=len(filters)-index_-2
if k <0:
k=0
dilate_rate = [2 ** i for i in range(int(log2(max_dilate_rate)) + 1)]
x_list = [x]
for rate in dilate_rate:
conv_param_global['dilation_rate'] = rate
x = block(filters[k], 3, 1, order=['c', 'r', 'b'], order_param=[conv_param_global, None, None])(x)
x_list.append(x)
x = tf.concat(x_list, axis=-1)
if index_ < len(list_max_dilate_rate) - 1:
x = block(filters[k], 3, 2, order=['dc', 'r', 'b'], order_param=[conv_param_local, None, None])(x)
x = block(filters[0], 3, 1, order=['c', 'r', 'b'], order_param=[conv_param_local, None, None])(x)
out = block(config['channel_label_num'], 1, 1, order=['c', 'b', 's'], order_param=[conv_param_local, None, None])(x)
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], out, config)
else:
return create_and_compile_model(inputs, out, config)
def model_U_net_old(self, config, depth=None):
conv_param = config['convolution_parameter']
inputs = Input(shape=(*config['patch_size'],) + (config['channel_img_num'],), name='inp1')
x = inputs
in_pos = None
levels = list()
# add levels with max pooling
if depth is None: depth = 5
for d in range(depth):
x = block(config['filters'] * (2 ** d), 3, 1, order=['c', 'b', 'r'], order_param=[None, None, conv_param])(
x)
x = block(config['filters'] * (2 ** d) * 2, 3, 1, order=['c', 'b', 'r'],
order_param=[None, None, conv_param])(x)
levels.append(x)
if d < depth - 1: x = MaxPooling3D(pool_size=2)(x)
# add levels with up-convolution or up-sampling
for layer_depth in range(depth - 2, -1, -1):
x = UpSampling3D(size=2)(x)
x = concatenate([x, levels[layer_depth]], axis=4)
x = block(levels[layer_depth].shape[-1], 3, 1, order=['c', 'b', 'r', 'c', 'b', 'r'],
order_param=[conv_param, None, None, conv_param, None, None])(x)
out = block(config['channel_label_num'], 1, 1, order=['c', 's'], order_param=[conv_param, None])(x)
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], out, config)
else:
return create_and_compile_model(inputs, out, config)
# UNet with (noised) positional input (feed_pos) and in-block skips
def model_U_net(self, config):
conv_param = config['convolution_parameter']
conv_param_d = copy.deepcopy(conv_param)
inputs = Input(shape=(*config['patch_size'],) + (config['channel_img_num'],), name='inp1')
x = inputs
x = block(4, 7, 1, order=['c', 'b', 'r'], order_param=[conv_param_d, None, None])(x)
conv_param_d['dilation_rate'] = 2
x = block(4, 7, 1, order=['c', 'b', 'r'], order_param=[conv_param_d, None, None])(x)
conv_param_d['dilation_rate'] = 3
x = block(4, 7, 1, order=['c', 'b', 'r'], order_param=[conv_param_d, None, None])(x)
conv_param_d['dilation_rate'] = 4
x = block(8, 7, 1, order=['c', 'b', 'r'], order_param=[conv_param_d, None, None])(x)
filters = [config['filters'] * 2 ** i for i in range(int(log2(inputs.shape[1])))]
skip_layer = []
for i_f, f in enumerate(filters):
if x.shape[1] > 2:
x = block(f, 4, 2, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
else:
x = block(f, 2, 2, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
skip_layer.append(x)
x = skip_layer[-1]
f = x.shape[-1]
x = block(f * 4, 1, 1, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
x = block(f, 1, 1, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
if config['feed_pos']:
in_pos = Input(shape=(3,), name='input_position')
pos = Reshape(target_shape=(1, 1, 1, 3))(in_pos)
if config['pos_noise_stdv'] != 0: pos = GaussianNoise(config['pos_noise_stdv'])(pos)
pos = UpSampling3D(size=x.shape[1:4])(BatchNormalization()(pos))
x = Concatenate(axis=-1)([x, pos])
skip_layer[-1] = x
x = skip_layer[-2]
f = x.shape[-1]
x = block(f * 4, 2, 1, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
x = block(f, 2, 1, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
if config['feed_pos']:
pos = block(f, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(pos)
x = Concatenate(axis=-1)([x, pos])
skip_layer[-2] = x
x = skip_layer[-1]
for sk, f in reversed(list(zip(skip_layer[:-1], filters[:-1]))):
x = block(f, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
x = tf.concat([x, sk], axis=-1)
x = block(filters[0], 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
x = tf.concat([x, inputs], axis=-1)
x = block(filters[0], 4, 1, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
out = block(config['channel_label_num'], 4, 1, order=['c', 'b', 's'], order_param=[conv_param, None, None])(x)
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], out, config)
else:
return create_and_compile_model(inputs, out, config)
def model_dilated_dense_net(self, config, len_dense=None, base_filter=32, param_dense_filter=None):
conv_param = config['convolution_parameter']
in_pos = None
def dense(x, f, rates, conv_param):
"""
:param f: type int: number of filter
:param rates: type list of int: list of positive ints
:param len_dense: type list of int: list of positive ints
:return:
"""
for i, rate in enumerate(rates):
conv_param['dilated_rate'] = rate
x = block(f, 3, 1, order=['b', 'r', 'c'], order_param=[None, None, conv_param])(x)
x = block(f, 3, 2, order=['b', 'r', 'c'], order_param=[None, None, conv_param])(x)
return x
if param_dense_filter is None: param_dense_filter = [1, 1]
f1, f2 = param_dense_filter[0], param_dense_filter[1]
inputs = Input(shape=(*config['patch_size'],) + (config['channel_img_num'],), name='inp0')
dilation_rates = [[1, 1, 2, 2, 3], [1, 1, 3], [2, 1], [1, 1], [1, 1]]
if len_dense == None: len_dense = [4, 4, 4, 4, 4]
shortcuts = []
x = inputs
for rates, l in zip(dilation_rates, len_dense):
x = dense_block(l, base_filter, conv_param)(x)
shortcuts.append(x)
x = dense(x, int(round((f1 + base_filter * l) * f2)), rates, conv_param)
if config['feed_pos']:
in_pos = Input(shape=(3,), name='input_position')
pos = Reshape(target_shape=(1, 1, 1, 3))(in_pos)
if config['pos_noise_stdv'] != 0: pos = GaussianNoise(config['pos_noise_stdv'])(pos)
pos = UpSampling3D(size=x.shape[1:4])(BatchNormalization()(pos))
x = Concatenate(axis=-1)([x, pos])
conv_param['dilated_rate'] = 1
for l, shortcut in reversed(list(zip(len_dense, shortcuts))):
x = dense_block(l, base_filter, conv_param)(x)
x = block(int(round((f1 + base_filter * l) * f2 / 2)), 3, 1, order=['b', 'r', 'c', 'up'],
order_param=[None, None, conv_param, None])(x)
x = Concatenate(axis=-1)([shortcut, x])
out = block(config['channel_label_num'], 4, 1, order=['c', 'b', 's'], order_param=[conv_param, None, None])(x)
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], out, config)
else:
return create_and_compile_model(inputs, out, config)
# UNet with double decoder
def model_U_net_double_decoder(self, config):
"UNet with double and parallel decoder path "
conv_param = config['convolution_parameter']
conv_param_dilated = config['convolution_parameter']
inputs = Input(shape=(*config['patch_size'],) + (config['channel_img_num'],), name='inp1')
x = inputs
filters = [config['filters'] * 2 ** i for i in range(5)]
filters_2 = [config['filters'] // 2 * 2 ** i for i in range(5)]
skip_layer = []
for index, f in enumerate(filters):
conv_param['dilation_rate'] = 1
x = block(f, 4, 2, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
conv_param_dilated['dilation_rate'] = 2 if index < 4 else 1
x = block(f, 4, 1, order=['c', 'b', 'r'], order_param=[conv_param_dilated, None, None])(x)
skip_layer.append(x)
x = skip_layer[-1]
if config['feed_pos']:
in_pos = Input(shape=(3,), name='input_position')
pos = Reshape(target_shape=(1, 1, 1, 3))(in_pos)
if config['pos_noise_stdv'] != 0: pos = GaussianNoise(config['pos_noise_stdv'])(pos)
pos = UpSampling3D(size=x.shape[1:4])(BatchNormalization()(pos))
x = Concatenate(axis=-1)([x, pos])
x_up = 0
for index, (sk, f, f_2) in enumerate(reversed(list(zip(skip_layer[:-1], filters[:-1], filters_2[:-1])))):
x = block(f, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
x_1 = x
x = tf.concat([x, sk], axis=-1)
if index == 0:
x_up = block(f_2, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x_1)
else:
x_1 = block(f_2, 4, 1, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x_1)
x_1 = tf.concat([x_1, x_up], axis=-1)
x_up = block(f_2, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x_1)
x = block(filters[0] // 2, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
x = x + x_up
out = block(config['channel_label_num'], 4, 1, order=['c', 'b', 's'], order_param=[conv_param, None, None])(x)
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], out, config)
else:
return create_and_compile_model(inputs, out, config)
# UNet with positional information handled in decoder
def model_U_net_position_decoder(self, config):
"""Network of merging the position info at each decoder """
conv_param = config['convolution_parameter']
inputs = Input(shape=(*config['patch_size'],) + (config['channel_img_num'],), name='inp1')
x = inputs
filters = [config['filters'] * 2 ** i for i in range(5)]
skip_layer = []
for f in filters:
x = block(f, 4, 2, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
skip_layer.append(x)
x = skip_layer[-1]
list_pos = []
if config['feed_pos']:
pos_filters = [config['filters'] * 2 ** i for i in range(4, -1, -1)]
in_pos = Input(shape=(3,), name='input_position')
pos = Reshape(target_shape=(1, 1, 1, 3))(in_pos)
if config['pos_noise_stdv'] != 0: pos = GaussianNoise(config['pos_noise_stdv'])(pos)
pos = UpSampling3D(size=x.shape[1:4])(BatchNormalization()(pos))
x = Concatenate(axis=-1)([x, pos])
for f in pos_filters:
pos = block(f, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(pos)
list_pos.append(pos)
for index, (sk, f) in enumerate(reversed(list(zip(skip_layer[:-1], filters[:-1])))):
x = block(f, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
if config['feed_pos']:
x = tf.concat([x, sk, list_pos[index]], axis=-1)
else:
x = tf.concat([x, sk], axis=-1)
x = block(filters[0], 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
out = block(config['channel_label_num'], 4, 1, order=['c', 'b', 's'], order_param=[conv_param, None, None])(x)
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], out, config)
else:
return create_and_compile_model(inputs, out, config)
# UNet with attention focusing
def model_U_net_attention(self, config):
"Experimental"
conv_param = config['convolution_parameter']
inputs = Input(shape=(*config['patch_size'],) + (config['channel_img_num'],), name='inp1')
x = inputs
filters = [config['filters'] * 2 ** i for i in range(5)]
skip_layer = []
for f in filters:
x = block(f, 4, 2, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
skip_layer.append(x)
x = skip_layer[-1]
in_pos = None
if config['feed_pos']:
in_pos = Input(shape=(3,), name='input_position')
pos = Reshape(target_shape=(1, 1, 1, 3))(in_pos)
if config['pos_noise_stdv'] != 0: pos = GaussianNoise(config['pos_noise_stdv'])(pos)
pos = UpSampling3D(size=x.shape[1:4])(BatchNormalization()(pos))
x = Concatenate(axis=-1)([x, pos])
for sk, f in reversed(list(zip(skip_layer[:-1], filters[:-1]))):
x = block(f, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
x = attention_layer_1(f, conv_param=conv_param, filters=16, alpha=1)(x, sk)
x = block(filters[0], 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
out = block(config['channel_label_num'], 4, 1, order=['c', 'b', 's'], order_param=[conv_param, None, None])(x)
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], out, config)
else:
return create_and_compile_model(inputs, out, config)
def model_U_net_2double_decoder(self, config):
"""2 cascade U Net double decoder"""
conv_param = config['convolution_parameter']
conv_param_dilated = config['convolution_parameter']
inputs = Input(shape=(*config['patch_size'],) + (config['channel_img_num'],), name='inp1')
x = inputs
filters = [config['filters'] * 2 ** i for i in range(5)]
filters_2 = [config['filters'] // 2 * 2 ** i for i in range(5)]
skip_layer = []
for index, f in enumerate(filters):
conv_param['dilation_rate'] = 1
x = block(f, 4, 2, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
conv_param_dilated['dilation_rate'] = 2 if index < 4 else 1
x = block(f, 4, 1, order=['c', 'b', 'r'], order_param=[conv_param_dilated, None, None])(x)
skip_layer.append(x)
x = skip_layer[-1]
if config['feed_pos']:
in_pos = Input(shape=(3,), name='input_position')
pos = Reshape(target_shape=(1, 1, 1, 3))(in_pos)
if config['pos_noise_stdv'] != 0: pos = GaussianNoise(config['pos_noise_stdv'])(pos)
pos = UpSampling3D(size=x.shape[1:4])(BatchNormalization()(pos))
x = Concatenate(axis=-1)([x, pos])
x_up = 0
for index, (sk, f, f_2) in enumerate(reversed(list(zip(skip_layer[:-1], filters[:-1], filters_2[:-1])))):
x = block(f, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
x_1 = x
x = tf.concat([x, sk], axis=-1)
if index == 0:
x_up = block(f_2, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x_1)
else:
x_1 = block(f_2, 4, 1, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x_1)
x_1 = tf.concat([x_1, x_up], axis=-1)
x_up = block(f_2, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x_1)
x = block(filters[0] // 2, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
x = x + x_up
skip_layer = []
for index, f in enumerate(filters):
conv_param['dilation_rate'] = 1
x = block(f, 4, 2, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x)
conv_param_dilated['dilation_rate'] = 2 if index < 4 else 1
x = block(f, 4, 1, order=['c', 'b', 'r'], order_param=[conv_param_dilated, None, None])(x)
skip_layer.append(x)
x = skip_layer[-1]
if config['feed_pos']:
x = Concatenate(axis=-1)([x, pos])
x_up = 0
for index, (sk, f, f_2) in enumerate(reversed(list(zip(skip_layer[:-1], filters[:-1], filters_2[:-1])))):
x = block(f, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
x_1 = x
x = tf.concat([x, sk], axis=-1)
if index == 0:
x_up = block(f_2, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x_1)
else:
x_1 = block(f_2, 4, 1, order=['c', 'b', 'r'], order_param=[conv_param, None, None])(x_1)
x_1 = tf.concat([x_1, x_up], axis=-1)
x_up = block(f_2, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x_1)
x = block(filters[0] // 2, 4, 2, order=['dc', 'b', 'r'], order_param=[conv_param, None, None])(x)
x = x + x_up
out = block(config['channel_label_num'], 4, 1, order=['c', 'b', 's'], order_param=[conv_param, None, None])(x)
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], out, config)
else:
return create_and_compile_model(inputs, out, config)
def model_body_identification_hybrid(self, config):
'''
Model is build after Philip Wolfs (ISS master student) model
Changed output shape and removed one dense layer at the end
'''
inputs = Input(shape=config['patch_size'], name='input_layer')
n_base_filter = 32
reshaped = Reshape([config['patch_size'][1], config['patch_size'][2], 1])(inputs)
in_pos = Input(shape=(3,), name='input_position')
# Some convolutional layers
conv_1 = Conv2D(n_base_filter,
kernel_size=(2, 2),
padding='same',
activation='relu')(reshaped)
conv_2 = Conv2D(n_base_filter,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_1)
conv_2 = MaxPooling2D(pool_size=(3, 3), padding='same')(conv_2)
# Some convolutional layers
conv_3 = Conv2D(n_base_filter * 2,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_2)
conv_4 = Conv2D(n_base_filter * 2,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_3)
conv_4 = MaxPooling2D(pool_size=(2, 2), padding='same')(conv_4)
# Now layers 8-12 in Philips net, no pooling at the end
conv_5 = Conv2D(n_base_filter * 4,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_4)
conv_6 = Conv2D(n_base_filter * 8,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_5)
conv_6 = MaxPooling2D(pool_size=(2, 2),
padding='same')(conv_6)
conv_7 = Conv2D(n_base_filter * 16,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_6)
conv_8 = Conv2D(n_base_filter * 32,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_7)
# Decided against second dense layer,
# As the dense/dense combination contributed another 16 million parameters
# dense_1 = Dense(4096, activation='relu')(conv_8)
# dropout_1 = Dropout(0.2)(dense_1)
dense_2 = Dense(4096, activation='relu')(conv_8)
# Here additional flattening layer to get right dimensionsionality
flattening_1 = Flatten()(dense_2)
dense_3 = Dense(config['body_identification_n_classes'], activation='relu')(flattening_1)
landmark_class_probability = Dense(config['body_identification_n_classes'], activation='softmax', name='class')(dense_3)
direct_regression = Dense(1, activation='linear', name='reg')(dense_3)
# Wrap in a Model
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], (landmark_class_probability, direct_regression), config)
else:
return create_and_compile_model(inputs, [landmark_class_probability, direct_regression], config)
def model_body_identification_classification(self, config):
'''
Model is build after Philip Wolfs (ISS master student) model
Changed output shape and removed one dense layer at the end
'''
inputs = Input(shape=config['patch_size'], name='input_layer')
in_pos = None
n_base_filter = 32
reshaped = Reshape([config['patch_size'][1], config['patch_size'][2], 1])(inputs)
# Some convolutional layers
conv_1 = Conv2D(n_base_filter,
kernel_size=(2, 2),
padding='same',
activation='relu')(reshaped)
conv_2 = Conv2D(n_base_filter,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_1)
conv_2 = MaxPooling2D(pool_size=(3, 3), padding='same')(conv_2)
# Some convolutional layers
conv_3 = Conv2D(n_base_filter * 2,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_2)
conv_4 = Conv2D(n_base_filter * 2,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_3)
conv_4 = MaxPooling2D(pool_size=(2, 2), padding='same')(conv_4)
# Now layers 8-12 in Philips net, no pooling at the end
conv_5 = Conv2D(n_base_filter * 4,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_4)
conv_6 = Conv2D(n_base_filter * 8,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_5)
conv_6 = MaxPooling2D(pool_size=(2, 2),
padding='same')(conv_6)
conv_7 = Conv2D(n_base_filter * 16,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_6)
conv_8 = Conv2D(n_base_filter * 32,
kernel_size=(2, 2),
padding='same',
activation='relu')(conv_7)
# Decided against second dense layer,
# As the dense/dense combination contributed another 16 million parameters
# dense_1 = Dense(4096, activation='relu')(conv_8)
# dropout_1 = Dropout(0.2)(dense_1)
dense_2 = Dense(4096, activation='relu')(conv_8)
# Here additional flattening layer to get right dimensionsionality
flattening_1 = Flatten()(dense_2)
dense_3 = Dense(config['body_identification_n_classes'], activation='relu',name='output_a')(flattening_1)
landmark_class_probability = Dense(config['body_identification_n_classes'], activation='softmax',name='output_b')(dense_3)
# Wrap in a Model
if config['feed_pos']:
return create_and_compile_model([inputs, in_pos], landmark_class_probability, config)
else:
return create_and_compile_model(inputs, landmark_class_probability, config)
"""
=== end network models
"""
def create_and_compile_model(inputs, outputs, config,premodel=None):
"""
create and compile model
:param inputs: type Tensor: input of the network
:param outputs: type Tensor: output of the network
:param config: type dict: configuring parameter
:return: model : type Model
"""
def loss_func(y_true, y_pred):
sum_ = 0
if 'loss_functions' in config:
for name_loss_function in config['loss_functions']:
loss_func = getattr(loss_function, name_loss_function)(y_true, y_pred,config=config)
weight = config['loss_functions'][name_loss_function]
sum_ = sum_ + weight * loss_func
return sum_
if premodel is None:
if config['feed_pos']:
assert (len(inputs) >= 2)
model = Model([inputs[0], inputs[1]], outputs)
if config['multi_gpu']: model = multi_gpu_model(model, gpus=config['multi_gpu'])
else:
model = Model(inputs, outputs)
else:
model=premodel
if config['multi_gpu']: model = multi_gpu_model(model, gpus=config['multi_gpu'])
flatten = lambda x: [y for l in x for y in flatten(l)] if type(x) is list else [x]
if premodel is None:
if isinstance(outputs,list):
custom_metrics=[]
for output in outputs:
custom_metric = flatten(
[get_custom_metrics(output.shape[-1], m, config) for m in config['custom_metrics']])
custom_metrics.append(custom_metric)
custom_metrics=flatten(custom_metrics)
else:
custom_metrics = flatten([get_custom_metrics(outputs.shape[-1], m, config) for m in config['custom_metrics']])
else:
custom_metrics = flatten([get_custom_metrics(outputs.output_shape[-1], m, config) for m in config['custom_metrics']])
list_metric_name = config['tensorflow_metrics'] + [m.__name__ for m in custom_metrics]
optimizer_func = convert_tf_optimizer(config)
if custom_metrics is None:
custom_metrics_list=config['tensorflow_metrics']
else:
custom_metrics_list = config['tensorflow_metrics']+ custom_metrics
if config['use_multiple_loss_function']:
# Multiple network output
loss_func_dict= config['multiple_loss_function']
for key in loss_func_dict.keys():
if loss_func_dict[key]=='loss_function':
loss_func_dict[key]=loss_func
else:
# Single network output
loss_func_dict=loss_func
model.compile(loss=loss_func_dict,
optimizer=optimizer_func,
metrics=custom_metrics_list)
return model, list_metric_name
| 45.862069
| 130
| 0.561487
| 4,903
| 35,910
| 3.892515
| 0.054253
| 0.063663
| 0.052083
| 0.069688
| 0.832172
| 0.811056
| 0.79497
| 0.78601
| 0.771706
| 0.758501
| 0
| 0.027824
| 0.287413
| 35,910
| 782
| 131
| 45.920716
| 0.718004
| 0.059844
| 0
| 0.734349
| 0
| 0
| 0.079177
| 0.012401
| 0
| 0
| 0
| 0
| 0.001692
| 1
| 0.025381
| false
| 0
| 0.015228
| 0
| 0.087986
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
68fe97f8253d81c4b3376564ff0c281d6ff0a99e
| 106
|
py
|
Python
|
stable_baselines3/ppo/__init__.py
|
koulakis/stable-baselines3
|
08e7519381e800edc6bbd09577f14381b7341873
|
[
"MIT"
] | 1
|
2020-06-24T16:57:19.000Z
|
2020-06-24T16:57:19.000Z
|
stable_baselines3/ppo/__init__.py
|
koulakis/stable-baselines3
|
08e7519381e800edc6bbd09577f14381b7341873
|
[
"MIT"
] | null | null | null |
stable_baselines3/ppo/__init__.py
|
koulakis/stable-baselines3
|
08e7519381e800edc6bbd09577f14381b7341873
|
[
"MIT"
] | null | null | null |
from stable_baselines3.ppo.ppo import PPO
from stable_baselines3.ppo.policies import MlpPolicy, CnnPolicy
| 35.333333
| 63
| 0.867925
| 15
| 106
| 6
| 0.533333
| 0.222222
| 0.444444
| 0.511111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.020619
| 0.084906
| 106
| 2
| 64
| 53
| 0.907216
| 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
| 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
| 1
| 0
|
0
| 8
|
ec4bd40d335af8d8c1de608b0db2d5fbbc9ceba3
| 18,728
|
py
|
Python
|
data_service/views/stock_price.py
|
freelancing-solutions/GCP-Based-Database-as-a-Service
|
7d6a12c33db238ca2f748bf4ddea6d2cf3c16da3
|
[
"MIT"
] | 1
|
2021-04-15T19:45:04.000Z
|
2021-04-15T19:45:04.000Z
|
data_service/views/stock_price.py
|
freelancing-solutions/pinydesk
|
7d6a12c33db238ca2f748bf4ddea6d2cf3c16da3
|
[
"MIT"
] | 516
|
2021-05-02T11:46:36.000Z
|
2022-03-29T06:09:49.000Z
|
data_service/views/stock_price.py
|
freelancing-solutions/pinydesk
|
7d6a12c33db238ca2f748bf4ddea6d2cf3c16da3
|
[
"MIT"
] | 1
|
2021-09-04T22:40:14.000Z
|
2021-09-04T22:40:14.000Z
|
import typing
import functools
from google.api_core.exceptions import RetryError, Aborted
from flask import current_app, jsonify
from google.cloud.ndb.exceptions import BadRequestError, BadQueryError
from data_service.main import cache_stocks
from data_service.config.exceptions import DataServiceError
from data_service.store.stocks import StockPriceData, Stock
from datetime import date
from data_service.utils.utils import create_id, return_ttl, date_days_ago
from data_service.config.exception_handlers import handle_view_errors
from data_service.config.use_context import use_context
def get_stock_price_data(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
stock_price_data: dict = kwargs.get('stock_price_data')
if 'stock_id' in stock_price_data and stock_price_data['stock_id'] != "":
stock_id: typing.Union[str, None] = stock_price_data.get('stock_id')
else:
stock_id = create_id(size=12)
if 'date_created' in stock_price_data and stock_price_data['date_created'] != "":
date_created: typing.Union[date, None] = stock_price_data.get('date_created')
else:
return jsonify({'status': False, 'message': 'date_created required'}), 500
if 'price_open' in stock_price_data and stock_price_data['price_open'] != "":
price_open: typing.Union[int, None] = stock_price_data.get('price_open')
else:
return jsonify({'status': False, 'message': 'price_open is required'}), 500
if 'price_high' in stock_price_data and stock_price_data['price_high'] != "":
price_high: typing.Union[int, None] = stock_price_data.get('price_high')
else:
return jsonify({'status': False, 'message': 'price_high is required'}), 500
if 'price_low' in stock_price_data and stock_price_data['price_low'] != "":
price_low: typing.Union[int, None] = stock_price_data.get('price_low')
else:
return jsonify({'status': False, 'message': 'price low is required'}), 500
if 'price_close' in stock_price_data and stock_price_data['price_close'] != "":
price_close: typing.Union[int, None] = stock_price_data.get('price_close')
else:
return jsonify({'status': False, 'message': 'price_close is required'}), 500
if 'adjusted_close' in stock_price_data and stock_price_data['adjusted_close'] != "":
adjusted_close: typing.Union[int, None] = stock_price_data.get('adjusted_close')
else:
return jsonify({'status': False, 'message': 'adjusted_close is required'}), 500
if 'volume' in stock_price_data and stock_price_data['volume'] != "":
volume: typing.Union[int, None] = stock_price_data.get('volume')
else:
return jsonify({'status': False, 'message': 'volume is required'}), 500
return func(stock_id=stock_id, date_created=date_created, price_open=price_open, price_high=price_high,
price_low=price_low, price_close=price_close, adjusted_close=adjusted_close,
volume=volume, *args)
return wrapper
# noinspection DuplicatedCode
class CatchStockPriceDataErrors:
def __init__(self):
super(CatchStockPriceDataErrors, self).__init__()
@staticmethod
def stock_exist(stock_id: typing.Union[str, None]) -> typing.Union[bool, None]:
try:
if not isinstance(stock_id, str):
return None
stock_instance: Stock = Stock.query(Stock.stock_id == stock_id).get()
if isinstance(stock_instance, Stock):
return True
return False
except BadRequestError:
return None
except BadQueryError:
return None
except ConnectionRefusedError:
return None
except RetryError:
return None
except Aborted:
return None
@staticmethod
async def stock_exist_async(stock_id: typing.Union[str, None]) -> typing.Union[bool, None]:
try:
if not isinstance(stock_id, str):
return None
stock_instance: Stock = Stock.query(Stock.stock_id == stock_id).get_async().get_result()
if isinstance(stock_instance, Stock):
return True
return False
except BadRequestError:
return None
except BadQueryError:
return None
except ConnectionRefusedError:
return None
except RetryError:
return None
except Aborted:
return None
@staticmethod
def price_data_exist(stock_id: typing.Union[str, None], date_created: typing.Union[date, None]) -> \
typing.Union[bool, None]:
try:
if not (isinstance(stock_id, str)):
return None
if not (isinstance(date_created, date)):
return None
stock_price_data: StockPriceData = StockPriceData.query(StockPriceData.stock_id == stock_id,
StockPriceData.date_created == date_created).get()
if isinstance(stock_price_data, StockPriceData):
return True
return False
except BadRequestError:
return None
except BadQueryError:
return None
except ConnectionRefusedError:
return None
except RetryError:
return None
except Aborted:
return None
@staticmethod
async def price_data_exist_async(stock_id: typing.Union[str, None], date_created: typing.Union[date, None]) -> \
typing.Union[bool, None]:
try:
if not (isinstance(stock_id, str)):
return None
if not (isinstance(date_created, date)):
return None
stock_price_data: StockPriceData = StockPriceData.query(StockPriceData.stock_id == stock_id,
StockPriceData.date_created == date_created).get_async().get_result()
if isinstance(stock_price_data, StockPriceData):
return True
return False
except BadRequestError:
return None
except BadQueryError:
return None
except ConnectionRefusedError:
return None
except RetryError:
return None
except Aborted:
return None
def can_add_price_data(self, stock_id: typing.Union[str, None],
date_created: typing.Union[date, None]) -> bool:
is_stock_exist = self.stock_exist(stock_id=stock_id)
is_price_data_exist = self.price_data_exist(stock_id=stock_id, date_created=date_created)
if isinstance(is_stock_exist, bool) and isinstance(is_price_data_exist, bool):
return is_stock_exist and not is_price_data_exist
message: str = "Unable to read database"
raise DataServiceError(status=500, description=message)
async def can_add_price_data_async(self, stock_id: typing.Union[str, None],
date_created: typing.Union[date, None]) -> bool:
is_stock_exist = await self.stock_exist_async(stock_id=stock_id)
is_price_data_exist = await self.price_data_exist_async(stock_id=stock_id, date_created=date_created)
if isinstance(is_stock_exist, bool) and isinstance(is_price_data_exist, bool):
return is_stock_exist and not is_price_data_exist
message: str = "Unable to read database"
raise DataServiceError(status=500, description=message)
class StockPriceDataView(CatchStockPriceDataErrors):
def __init__(self):
super(StockPriceDataView, self).__init__()
self._max_retries = current_app.config.get('DATASTORE_RETRIES')
self._max_timeout = current_app.config.get('DATASTORE_TIMEOUT')
@get_stock_price_data
@use_context
@handle_view_errors
def add_stock_price_data(self, stock_id: typing.Union[str, None],
date_created: typing.Union[date, None],
price_open: typing.Union[int, None],
price_high: typing.Union[int, None],
price_low: typing.Union[int, None],
price_close: typing.Union[int, None],
adjusted_close: typing.Union[int, None],
volume: typing.Union[int, None]
) -> tuple:
if self.can_add_price_data(stock_id=stock_id, date_created=date_created) is True:
stock_price_data_instance: StockPriceData = StockPriceData(stock_id=stock_id, date_created=date_created,
price_open=price_open, price_high=price_high,
price_low=price_low, price_close=price_close,
adjusted_close=adjusted_close, volume=volume)
key = stock_price_data_instance.put(retries=self._max_retries, timeout=self._max_timeout)
if key is None:
message: str = "Unable to write to database"
raise DataServiceError(status=500, description=message)
else:
message: str = "Stock price data may already be added"
return jsonify({'status': False, 'message': message}), 500
return jsonify({'status': True,
'message': 'successfully saved stock data',
"payload": stock_price_data_instance.to_dict()}), 200
@use_context
@handle_view_errors
async def add_stock_price_data_async(self,
stock_id: typing.Union[str, None],
date_created: typing.Union[date, None],
price_open: typing.Union[int, None],
price_high: typing.Union[int, None],
price_low: typing.Union[int, None],
price_close: typing.Union[int, None],
adjusted_close: typing.Union[int, None],
volume: typing.Union[int, None]
) -> tuple:
"""
add stock price data asynchronously
"""
if await self.can_add_price_data_async(stock_id=stock_id, date_created=date_created) is True:
stock_price_data_instance: StockPriceData = StockPriceData(stock_id=stock_id, date_created=date_created,
price_open=price_open, price_high=price_high,
price_low=price_low, price_close=price_close,
adjusted_close=adjusted_close, volume=volume)
key = stock_price_data_instance.put_async(retries=self._max_retries, timeout=self._max_timeout).get_result()
if key is None:
message: str = "Unable to write to database"
raise DataServiceError(status=500, description=message)
else:
message: str = "Stock price data may already be added"
return jsonify({'status': False, 'message': message}), 500
return jsonify({'status': True,
'message': 'successfully saved stock data',
"payload": stock_price_data_instance.to_dict()}), 200
@cache_stocks.cached(timeout=return_ttl(name='medium'))
@use_context
@handle_view_errors
def get_stock_price_data_list_by_date(self, date_created: typing.Union[date, None]) -> tuple:
stock_price_data_list: typing.List[StockPriceData] = StockPriceData.query(
StockPriceData.date_created == date_created).fetch()
payload: typing.List[dict] = [price_data.to_dict() for price_data in stock_price_data_list]
return jsonify({'status': True, 'payload': payload, 'message': 'successfully fetched stock price data'}), 200
@cache_stocks.cached(timeout=return_ttl(name='medium'))
@use_context
@handle_view_errors
async def get_stock_price_data_list_by_date_async(self, date_created: typing.Union[date, None]) -> tuple:
stock_price_data_list: typing.List[StockPriceData] = StockPriceData.query(
StockPriceData.date_created == date_created).fetch_async().get_result()
payload: typing.List[dict] = [price_data.to_dict() for price_data in stock_price_data_list]
return jsonify({'status': True, 'payload': payload, 'message': 'successfully fetched stock price data'}), 200
@cache_stocks.cached(timeout=return_ttl(name='medium'))
@use_context
@handle_view_errors
def get_monthly_stock_price_data_list_by_stock_id(self, stock_id: typing.Union[str, None]) -> tuple:
if not (isinstance(stock_id, str)):
return jsonify({'status': False, 'message': 'stock id is required'}), 500
one_month = date_days_ago(days=30)
stock_price_list: typing.List[StockPriceData] = StockPriceData.query(StockPriceData.stock_id == stock_id,
StockPriceData.date_created > one_month).fetch()
payload: typing.List[dict] = [price_data.to_dict() for price_data in stock_price_list]
message: str = 'successfully fetched monthly stock price data'
return jsonify({'status': True, 'payload': payload, 'message': message}), 200
@cache_stocks.cached(timeout=return_ttl(name='medium'))
@use_context
@handle_view_errors
async def get_monthly_stock_price_data_list_by_stock_id_async(self, stock_id: typing.Union[str, None]) -> tuple:
if not (isinstance(stock_id, str)):
return jsonify({'status': False, 'message': 'stock id is required'}), 500
one_month = date_days_ago(days=30)
stock_price_list: typing.List[StockPriceData] = StockPriceData.query(StockPriceData.stock_id == stock_id,
StockPriceData.date_created > one_month).fetch_async().get_result()
payload: typing.List[dict] = [price_data.to_dict() for price_data in stock_price_list]
message: str = 'successfully fetched monthly stock price data'
return jsonify({'status': True, 'payload': payload, 'message': message}), 200
@cache_stocks.cached(timeout=return_ttl(name='medium'))
@use_context
@handle_view_errors
def get_weekly_stock_price_data_list_by_stock_id(self, stock_id: typing.Union[str, None]) -> tuple:
if not (isinstance(stock_id, str)):
return jsonify({'status': False, 'message': 'stock id is required'}), 500
week = date_days_ago(days=7)
stock_price_list: typing.List[StockPriceData] = StockPriceData.query(StockPriceData.stock_id == stock_id,
StockPriceData.date_created > week).fetch()
payload: typing.List[dict] = [price_data.to_dict() for price_data in stock_price_list]
message: str = 'successfully fetched weekly stock price data'
return jsonify({'status': True, 'payload': payload, 'message': message}), 200
@cache_stocks.cached(timeout=return_ttl(name='medium'))
@use_context
@handle_view_errors
async def get_weekly_stock_price_data_list_by_stock_id_async(self, stock_id: typing.Union[str, None]) -> tuple:
if not (isinstance(stock_id, str)):
return jsonify({'status': False, 'message': 'stock id is required'}), 500
week = date_days_ago(days=7)
stock_price_list: typing.List[StockPriceData] = StockPriceData.query(
StockPriceData.stock_id == stock_id, StockPriceData.date_created > week).fetch_async().get_result()
payload: typing.List[dict] = [price_data.to_dict() for price_data in stock_price_list]
message: str = 'successfully fetched weekly stock price data'
return jsonify({'status': True, 'payload': payload, 'message': message}), 200
@cache_stocks.cached(timeout=return_ttl(name='medium'))
@use_context
@handle_view_errors
def get_n_days_stock_price_data_list_by_stock_id(self, stock_id: typing.Union[str, None],
days: typing.Union[int, None]) -> tuple:
if not (isinstance(days, int)) or (days < 0):
return jsonify({'status': False, 'message': 'days is required and should be greater than 0'}), 500
if not (isinstance(stock_id, str)):
return jsonify({'status': False, 'message': 'stock id is required'}), 500
n_days = date_days_ago(days=days)
stock_price_list: typing.List[StockPriceData] = StockPriceData.query(StockPriceData.stock_id == stock_id,
StockPriceData.date_created > n_days).fetch()
payload: typing.List[dict] = [price_data.to_dict() for price_data in stock_price_list]
message: str = 'successfully fetched weekly stock price data'
return jsonify({'status': True, 'payload': payload, 'message': message}), 200
@cache_stocks.cached(timeout=return_ttl(name='medium'))
@use_context
@handle_view_errors
async def get_n_days_stock_price_data_list_by_stock_id_async(self, stock_id: typing.Union[str, None],
days: typing.Union[int, None]) -> tuple:
if not (isinstance(days, int)) or (days < 0):
return jsonify({'status': False, 'message': 'days is required and should be greater than 0'}), 500
if not (isinstance(stock_id, str)):
return jsonify({'status': False, 'message': 'stock id is required'}), 500
n_days = date_days_ago(days=days)
stock_price_list: typing.List[StockPriceData] = StockPriceData.query(StockPriceData.stock_id == stock_id,
StockPriceData.date_created > n_days).fetch_async().get_result()
payload: typing.List[dict] = [price_data.to_dict() for price_data in stock_price_list]
message: str = 'successfully fetched weekly stock price data'
return jsonify({'status': True, 'payload': payload, 'message': message}), 200
| 53.204545
| 144
| 0.618753
| 2,148
| 18,728
| 5.121043
| 0.067039
| 0.076091
| 0.080182
| 0.025455
| 0.897727
| 0.861455
| 0.839273
| 0.814091
| 0.782636
| 0.745364
| 0
| 0.007883
| 0.288819
| 18,728
| 351
| 145
| 53.356125
| 0.818004
| 0.001442
| 0
| 0.711039
| 0
| 0
| 0.090899
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.038961
| false
| 0
| 0.038961
| 0
| 0.295455
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
6b921769b23c87f873be8bbcfafb61eeb16af251
| 1,818
|
py
|
Python
|
Insert.py
|
ArchinDeepakTV/Covid_System
|
a2aa8acb10ed23c7a7e94dcf1ff51815d847ad2f
|
[
"MIT"
] | null | null | null |
Insert.py
|
ArchinDeepakTV/Covid_System
|
a2aa8acb10ed23c7a7e94dcf1ff51815d847ad2f
|
[
"MIT"
] | null | null | null |
Insert.py
|
ArchinDeepakTV/Covid_System
|
a2aa8acb10ed23c7a7e94dcf1ff51815d847ad2f
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python
import psycopg2
from config import config
def insert_hospitals(ID):
""" insert a new vendor into the vendors table """
sql = """INSERT INTO hospitals(hospital_id)
VALUES(%s) RETURNING hospital_id;"""
conn = None
vendor_id = None
try:
# read database configuration
params = config()
# connect to the PostgreSQL database
conn = psycopg2.connect(**params)
# create a new cursor
cur = conn.cursor()
# execute the INSERT statement
cur.execute(sql, (ID,))
# get the generated ID back
vendor_id = cur.fetchone()[0]
# commit the changes to the database
conn.commit()
# close communication with the database
cur.close()
except (Exception, psycopg2.DatabaseError) as error:
print(error)
finally:
if conn is not None:
conn.close()
return vendor_id
def insert_kin(mail_id):
""" insert a new vendor into the vendors table """
sql = """INSERT INTO kin(mail_id)
VALUES(%s) RETURNING mail_id;"""
conn = None
vendor_id = None
try:
# read database configuration
params = config()
# connect to the PostgreSQL database
conn = psycopg2.connect(**params)
# create a new cursor
cur = conn.cursor()
# execute the INSERT statement
cur.execute(sql, (mail_id,))
# get the generated ID back
vendor_id = cur.fetchone()[0]
# commit the changes to the database
conn.commit()
# close communication with the database
cur.close()
except (Exception, psycopg2.DatabaseError) as error:
print(error)
finally:
if conn is not None:
conn.close()
return vendor_id
| 27.545455
| 56
| 0.59516
| 215
| 1,818
| 4.967442
| 0.283721
| 0.044944
| 0.016854
| 0.022472
| 0.85206
| 0.85206
| 0.85206
| 0.85206
| 0.85206
| 0.85206
| 0
| 0.00565
| 0.318482
| 1,818
| 65
| 57
| 27.969231
| 0.856336
| 0.289329
| 0
| 0.75
| 0
| 0
| 0.116996
| 0.017391
| 0
| 0
| 0
| 0
| 0
| 1
| 0.05
| false
| 0
| 0.05
| 0
| 0.15
| 0.05
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
6ba008f822964168fef5f7aa17e630694a23ff1c
| 145
|
py
|
Python
|
python/utils/math_functions.py
|
memgraph/mage
|
8c389146dfce35c436e941b04655d9f758351e46
|
[
"Apache-2.0"
] | 67
|
2021-01-29T08:38:11.000Z
|
2022-03-22T08:39:47.000Z
|
python/utils/math_functions.py
|
memgraph/mage
|
8c389146dfce35c436e941b04655d9f758351e46
|
[
"Apache-2.0"
] | 35
|
2021-04-12T12:51:17.000Z
|
2022-03-18T13:24:39.000Z
|
python/utils/math_functions.py
|
memgraph/mage
|
8c389146dfce35c436e941b04655d9f758351e46
|
[
"Apache-2.0"
] | 4
|
2021-07-20T10:59:12.000Z
|
2021-12-15T08:07:11.000Z
|
from typing import List
import numpy as np
def normalize(an_array: List[float]) -> List[float]:
return np.array(an_array) / sum(an_array)
| 18.125
| 52
| 0.724138
| 24
| 145
| 4.25
| 0.583333
| 0.205882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.165517
| 145
| 7
| 53
| 20.714286
| 0.842975
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.5
| 0.25
| 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
| 1
| 1
| 1
| 0
|
0
| 7
|
6bc8eea28a1899074b23c53e6b3e9d203085f48f
| 2,143
|
py
|
Python
|
datasets/create_imagenets_t1.py
|
akshitac8/OW-DETR
|
9d6705f059a1eb51ea6edfa26ee624abeb67c775
|
[
"Apache-2.0"
] | 7
|
2022-03-29T22:38:05.000Z
|
2022-03-30T11:47:00.000Z
|
datasets/create_imagenets_t1.py
|
akshitac8/OW-DETR
|
9d6705f059a1eb51ea6edfa26ee624abeb67c775
|
[
"Apache-2.0"
] | null | null | null |
datasets/create_imagenets_t1.py
|
akshitac8/OW-DETR
|
9d6705f059a1eb51ea6edfa26ee624abeb67c775
|
[
"Apache-2.0"
] | null | null | null |
from pycocotools.coco import COCO
import numpy as np
T1_CLASS_NAMES = [
"airplane","bicycle","bird","boat","bus","car",
"cat","cow","dog","horse","motorcycle","sheep",
"train","elephant","bear","zebra","giraffe","truck","person"
]
# Train
coco_annotation_file = '../../data/coco/annotations/instances_train2017.json'
dest_file = '../../data/VOC2007/ImageSets/Main/t1_train_new_split.txt'
coco_instance = COCO(coco_annotation_file)
image_ids = []
cls = []
for index, image_id in enumerate(coco_instance.imgToAnns):
image_details = coco_instance.imgs[image_id]
classes = [coco_instance.cats[annotation['category_id']]['name'] for annotation in coco_instance.imgToAnns[image_id]]
if not set(classes).isdisjoint(T1_CLASS_NAMES):
image_ids.append(image_details['file_name'].split('.')[0])
cls.extend(classes)
(unique, counts) = np.unique(cls, return_counts=True)
print({x:y for x,y in zip(unique, counts)})
c = 0
for x,y in zip(unique, counts):
if x in T1_CLASS_NAMES:
c += y
print(c)
print(len(image_ids))
with open(dest_file, 'w') as file:
for image_id in image_ids:
file.write(str(image_id)+'\n')
print('Created train file')
# Test
coco_annotation_file = '../../data/coco/annotations/instances_val2017.json'
dest_file = '../../data/VOC2007/ImageSets/Main/t1_test_new_split.txt'
coco_instance = COCO(coco_annotation_file)
image_ids = []
cls = []
for index, image_id in enumerate(coco_instance.imgToAnns):
image_details = coco_instance.imgs[image_id]
classes = [coco_instance.cats[annotation['category_id']]['name'] for annotation in coco_instance.imgToAnns[image_id]]
if not set(classes).isdisjoint(T1_CLASS_NAMES):
image_ids.append(image_details['file_name'].split('.')[0])
cls.extend(classes)
(unique, counts) = np.unique(cls, return_counts=True)
print({x:y for x,y in zip(unique, counts)})
c = 0
for x,y in zip(unique, counts):
if x in T1_CLASS_NAMES:
c += y
print(c)
print(len(image_ids))
with open(dest_file, 'w') as file:
for image_id in image_ids:
file.write(str(image_id)+'\n')
print('Created test file')
| 29.763889
| 121
| 0.699487
| 323
| 2,143
| 4.430341
| 0.263158
| 0.083857
| 0.041929
| 0.072676
| 0.856744
| 0.856744
| 0.856744
| 0.792453
| 0.739343
| 0.739343
| 0
| 0.014682
| 0.141857
| 2,143
| 71
| 122
| 30.183099
| 0.763458
| 0.004666
| 0
| 0.754717
| 0
| 0
| 0.188732
| 0.1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.037736
| 0
| 0.037736
| 0.150943
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
d4056a327e646aeecd145b5d60afad3f463641ef
| 8,665
|
py
|
Python
|
pvae/models/architectures.py
|
thanosvlo/Causal-Future-Prediction-in-a-Minkowski-Space-Time
|
0e0539a122484ce9869aca9acd436a24c2597908
|
[
"MIT"
] | 8
|
2020-08-31T20:34:44.000Z
|
2021-05-26T20:32:22.000Z
|
pvae/models/architectures.py
|
thanosvlo/Causal-Future-Prediction-in-a-Minkowski-Space-Time
|
0e0539a122484ce9869aca9acd436a24c2597908
|
[
"MIT"
] | null | null | null |
pvae/models/architectures.py
|
thanosvlo/Causal-Future-Prediction-in-a-Minkowski-Space-Time
|
0e0539a122484ce9869aca9acd436a24c2597908
|
[
"MIT"
] | null | null | null |
import torch
import torch.nn as nn
import torch.nn.functional as F
from numpy import prod
from pvae.utils import Constants
from pvae.ops.manifold_layers import GeodesicLayer, MobiusLayer, LogZero, ExpZero
def extra_hidden_layer(hidden_dim, non_lin):
return nn.Sequential(nn.Linear(hidden_dim, hidden_dim), non_lin)
def extra_hidden_layer_conv(hidden_dim, non_lin):
return nn.Sequential(nn.Conv2d(hidden_dim, hidden_dim, 3,1,1), non_lin)
class EncLinear(nn.Module):
""" Usual encoder """
def __init__(self, manifold, data_size, non_lin, num_hidden_layers, hidden_dim, prior_iso):
super(EncLinear, self).__init__()
self.manifold = manifold
self.data_size = data_size
modules = []
modules.append(nn.Sequential(nn.Linear(prod(data_size), hidden_dim), non_lin))
modules.extend([extra_hidden_layer(hidden_dim, non_lin) for _ in range(num_hidden_layers - 1)])
self.enc = nn.Sequential(*modules)
self.fc21 = nn.Linear(hidden_dim, manifold.coord_dim)
self.fc22 = nn.Linear(hidden_dim, manifold.coord_dim if not prior_iso else 1)
def forward(self, x):
e = self.enc(x.view(*x.size()[:-len(self.data_size)], -1))
mu = self.fc21(e) # flatten data
return mu, F.softplus(self.fc22(e)) + Constants.eta, self.manifold
class DecLinear(nn.Module):
""" Usual decoder """
def __init__(self, manifold, data_size, non_lin, num_hidden_layers, hidden_dim):
super(DecLinear, self).__init__()
self.data_size = data_size
modules = []
modules.append(nn.Sequential(nn.Linear(manifold.coord_dim, hidden_dim), non_lin))
modules.extend([extra_hidden_layer(hidden_dim, non_lin) for _ in range(num_hidden_layers - 1)])
self.dec = nn.Sequential(*modules)
self.fc31 = nn.Linear(hidden_dim, prod(data_size))
def forward(self, z):
d = self.dec(z)
mu = self.fc31(d).view(*z.size()[:-1], *self.data_size) # reshape data
return mu, torch.ones_like(mu)
class EncWrapped(nn.Module):
""" Usual encoder followed by an exponential map """
def __init__(self, manifold, data_size, non_lin, num_hidden_layers, hidden_dim, prior_iso):
super(EncWrapped, self).__init__()
self.manifold = manifold
self.data_size = data_size
modules = []
modules.append(nn.Sequential(nn.Linear(prod(data_size), hidden_dim), non_lin))
modules.extend([extra_hidden_layer(hidden_dim, non_lin) for _ in range(num_hidden_layers - 1)])
self.enc = nn.Sequential(*modules)
self.fc21 = nn.Linear(hidden_dim, manifold.coord_dim)
self.fc22 = nn.Linear(hidden_dim, manifold.coord_dim if not prior_iso else 1)
def forward(self, x):
e = self.enc(x.view(*x.size()[:-len(self.data_size)], -1))
mu = self.fc21(e) # flatten data
mu = self.manifold.expmap0(mu)
return mu, F.softplus(self.fc22(e)) + Constants.eta, self.manifold
class DecWrapped(nn.Module):
""" Usual encoder preceded by a logarithm map """
def __init__(self, manifold, data_size, non_lin, num_hidden_layers, hidden_dim):
super(DecWrapped, self).__init__()
self.data_size = data_size
self.manifold = manifold
modules = []
modules.append(nn.Sequential(nn.Linear(manifold.coord_dim, hidden_dim), non_lin))
modules.extend([extra_hidden_layer(hidden_dim, non_lin) for _ in range(num_hidden_layers - 1)])
self.dec = nn.Sequential(*modules)
self.fc31 = nn.Linear(hidden_dim, prod(data_size))
def forward(self, z):
z = self.manifold.logmap0(z)
d = self.dec(z)
mu = self.fc31(d).view(*z.size()[:-1], *self.data_size) # reshape data
return mu, torch.ones_like(mu)
class DecGeo(nn.Module):
""" First layer is a Hypergyroplane followed by usual decoder """
def __init__(self, manifold, data_size, non_lin, num_hidden_layers, hidden_dim):
super(DecGeo, self).__init__()
self.data_size = data_size
modules = []
modules.append(nn.Sequential(GeodesicLayer(manifold.coord_dim, hidden_dim, manifold), non_lin))
modules.extend([extra_hidden_layer(hidden_dim, non_lin) for _ in range(num_hidden_layers - 1)])
self.dec = nn.Sequential(*modules)
self.fc31 = nn.Linear(hidden_dim, prod(data_size))
def forward(self, z):
d = self.dec(z)
mu = self.fc31(d).view(*z.size()[:-1], *self.data_size) # reshape data
return mu, torch.ones_like(mu)
class EncMob(nn.Module):
""" Last layer is a Mobius layers """
def __init__(self, manifold, data_size, non_lin, num_hidden_layers, hidden_dim, prior_iso):
super(EncMob, self).__init__()
self.manifold = manifold
self.data_size = data_size
modules = []
modules.append(nn.Sequential(nn.Linear(prod(data_size), hidden_dim), non_lin))
modules.extend([extra_hidden_layer(hidden_dim, non_lin) for _ in range(num_hidden_layers - 1)])
self.enc = nn.Sequential(*modules)
self.fc21 = MobiusLayer(hidden_dim, manifold.coord_dim, manifold)
self.fc22 = nn.Linear(hidden_dim, manifold.coord_dim if not prior_iso else 1)
def forward(self, x):
e = self.enc(x.view(*x.size()[:-len(self.data_size)], -1)) # flatten data
mu = self.fc21(e) # flatten data
mu = self.manifold.expmap0(mu)
return mu, F.softplus(self.fc22(e)) + Constants.eta, self.manifold
class DecMob(nn.Module):
""" First layer is a Mobius Matrix multiplication """
def __init__(self, manifold, data_size, non_lin, num_hidden_layers, hidden_dim):
super(DecMob, self).__init__()
self.data_size = data_size
modules = []
modules.append(nn.Sequential(MobiusLayer(manifold.coord_dim, hidden_dim, manifold), LogZero(manifold), non_lin))
modules.extend([extra_hidden_layer(hidden_dim, non_lin) for _ in range(num_hidden_layers - 1)])
self.dec = nn.Sequential(*modules)
self.fc31 = nn.Linear(hidden_dim, prod(data_size))
def forward(self, z):
d = self.dec(z)
mu = self.fc31(d).view(*z.size()[:-1], *self.data_size) # reshape data
return mu, torch.ones_like(mu)
class DecBernouilliWrapper(nn.Module):
""" Wrapper for Bernoulli likelihood """
def __init__(self, dec):
super(DecBernouilliWrapper, self).__init__()
self.dec = dec
def forward(self, z):
mu, _ = self.dec.forward(z)
return torch.tensor(1.0).to(z.device), mu
class EncWrapped_Conv(nn.Module):
""" Usual encoder followed by an exponential map """
def __init__(self, manifold, data_size, non_lin, num_hidden_layers, hidden_dim, prior_iso):
super(EncWrapped_Conv, self).__init__()
self.manifold = manifold
self.data_size = data_size
modules = []
modules.append(nn.Sequential(nn.Conv2d(data_size[0], hidden_dim, 3,1,1), non_lin))
modules.extend([extra_hidden_layer_conv(hidden_dim, non_lin) for _ in range(num_hidden_layers - 1)])
modules.extend(nn.Sequential(nn.Flatten(), non_lin))
modules.extend(nn.Sequential(nn.Linear(hidden_dim*data_size[1]*data_size[2], hidden_dim), non_lin))
self.enc = nn.Sequential(*modules)
self.fc21 = nn.Linear(hidden_dim, manifold.coord_dim)
self.fc22 = nn.Linear(hidden_dim, manifold.coord_dim if not prior_iso else 1)
def forward(self, x):
e = self.enc(x)
mu = self.fc21(e) # flatten data
mu = self.manifold.expmap0(mu)
return mu, F.softplus(self.fc22(e)) + Constants.eta, self.manifold
class DecWrapped_Conv(nn.Module):
""" Usual encoder preceded by a logarithm map """
def __init__(self, manifold, data_size, non_lin, num_hidden_layers, hidden_dim):
super(DecWrapped_Conv, self).__init__()
self.data_size = data_size
self.manifold = manifold
modules = []
modules.append(nn.Sequential(nn.Conv2d(manifold.coord_dim, hidden_dim, 3, 1, 1), non_lin))
modules.extend([extra_hidden_layer_conv(hidden_dim, non_lin) for _ in range(num_hidden_layers - 1)])
self.dec = nn.Sequential(*modules)
self.fc31 = nn.Linear(hidden_dim, prod(data_size))
def forward(self, z):
if len(z.shape) == 2:
z = z.unsqueeze(0)
z = self.manifold.logmap0(z)
d = self.dec(z.view(z.shape[1], z.shape[2], -1, 1))
d = d.view(d.shape[2], *d.shape[0:2])
mu = self.fc31(d).view(*z.size()[:-1], *self.data_size) # reshape data
return mu, torch.ones_like(mu)
| 42.684729
| 120
| 0.659319
| 1,235
| 8,665
| 4.375709
| 0.089069
| 0.079941
| 0.03997
| 0.049963
| 0.858438
| 0.839748
| 0.813101
| 0.80792
| 0.786825
| 0.777572
| 0
| 0.015238
| 0.212349
| 8,665
| 202
| 121
| 42.89604
| 0.776557
| 0.058742
| 0
| 0.701299
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0.038961
| 0.012987
| 0.324675
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
d44a786ce96802bfa86843baaae3cff6940ca5e4
| 82
|
py
|
Python
|
ips/ip/spi_slave/__init__.py
|
zld012739/zldrepository
|
5635b78a168956091676ef4dd99fa564be0e5ba0
|
[
"MIT"
] | null | null | null |
ips/ip/spi_slave/__init__.py
|
zld012739/zldrepository
|
5635b78a168956091676ef4dd99fa564be0e5ba0
|
[
"MIT"
] | null | null | null |
ips/ip/spi_slave/__init__.py
|
zld012739/zldrepository
|
5635b78a168956091676ef4dd99fa564be0e5ba0
|
[
"MIT"
] | null | null | null |
from spi_slave_partial import get_ip_name
from spi_slave_partial import SPI_SLAVE
| 27.333333
| 41
| 0.902439
| 15
| 82
| 4.466667
| 0.533333
| 0.358209
| 0.358209
| 0.567164
| 0.746269
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097561
| 82
| 2
| 42
| 41
| 0.905405
| 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
| 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
| 1
| 0
|
0
| 8
|
d44dc61b476043323b5403724c449de7b8be2a09
| 10,519
|
py
|
Python
|
yt_dlp/extractor/taobao.py
|
cpanel10x/yt-dlp
|
49c19b7912d5b7261a26df701356c0e41eb78daf
|
[
"Unlicense"
] | null | null | null |
yt_dlp/extractor/taobao.py
|
cpanel10x/yt-dlp
|
49c19b7912d5b7261a26df701356c0e41eb78daf
|
[
"Unlicense"
] | null | null | null |
yt_dlp/extractor/taobao.py
|
cpanel10x/yt-dlp
|
49c19b7912d5b7261a26df701356c0e41eb78daf
|
[
"Unlicense"
] | null | null | null |
# coding: utf-8
from .common import InfoExtractor
import json
from ..utils import (
int_or_none,
js_to_json,
mimetype2ext,
ExtractorError,
)
class TmallIE(InfoExtractor):
IE_NAME = 'tmall:product'
_VALID_URL = r'https?:\/\/(?:(?:www|[a-z]{2})\.)?detail\.tmall\.com\/.*?id\=(?P<id>\d+)'
_TESTS = [{
'url': 'https://detail.tmall.com/item.htm?id=656308694954',
'info_dict': {
'id': '656308694954',
'ext': 'mp4',
'title': 'Video title goes here',
'thumbnail': r're:^https?://.*\.jpg$',
# TODO more properties, either as:
# * A value
# * MD5 checksum; start the string with md5:
# * A regular expression; start the string with re:
# * Any Python type (for example int or float)
}
}]
def _real_extract(self, url):
pid = self._match_id(url)
webpage, urlh = self._download_webpage_handle(url, pid)
visitor_url = urlh.geturl()
if 'detail.tmall.com' in visitor_url:
vid = self._search_regex(
r'"imgVedioID"\s*:\s*"?(\d+)"?',
webpage, 'video id')
uid = self._search_regex(
r'"userId"\s*:\s*"?(?P<uid>\d+)"?',
webpage, 'video uid')
title = self._search_regex(r'<title>([^<]+)<', webpage, 'title')
elif 'item.taobao.com' in visitor_url:
vid = self._search_regex(
r'"videoId"\s*:\s*"?(\d+)"?',
webpage, 'video id')
uid = self._search_regex(
r'"videoOwnerId"\s*:\s*"?(?P<uid>\d+)"?',
webpage, 'video uid')
title = self._search_regex(r'<title>([^<]+)<', webpage, 'title')
return {
# I have no idea what these params mean but it at least seems to work
'url': 'https://cloud.video.taobao.com/play/u/%s/p/1/e/6/t/1/%s.mp4' % (uid, vid),
'id': vid,
'title': title,
}
class TaobaoIE(InfoExtractor):
IE_NAME = 'taobao:product'
_VALID_URL = r'https?:\/\/(?:(?:www|[a-z]{2})\.)?item\.taobao\.com\/.*?id\=(?P<id>\d+)'
_LOGIN_URL = 'https://login.taobao.com/member/login.jhtml'
_TESTS = [{
'url': 'https://item.taobao.com/item.htm?id=656308694954',
'info_dict': {
'id': '656308694954',
'ext': 'mp4',
'title': 'Video title goes here',
'thumbnail': r're:^https?://.*\.jpg$',
# TODO more properties, either as:
# * A value
# * MD5 checksum; start the string with md5:
# * A regular expression; start the string with re:
# * Any Python type (for example int or float)
}
}]
def _real_extract(self, url):
pid = self._match_id(url)
webpage, urlh = self._download_webpage_handle(url, pid)
visitor_url = urlh.geturl()
if 'login.jhtml' in visitor_url:
raise ExtractorError(
'Lỗi đăng nhập Taobao - Cookies Error - Vui lòng báo lỗi cho hỗ trợ @cpanel10x',
expected=True)
if 'detail.tmall.com' in visitor_url:
vid = self._search_regex(
r'"imgVedioID"\s*:\s*"?(\d+)"?',
webpage, 'video id')
uid = self._search_regex(
r'"userId"\s*:\s*"?(?P<uid>\d+)"?',
webpage, 'video uid')
title = self._search_regex(r'<title>([^<]+)<', webpage, 'title')
elif 'item.taobao.com' in visitor_url:
vid = self._search_regex(
r'"videoId"\s*:\s*"?(\d+)"?',
webpage, 'video id')
uid = self._search_regex(
r'"videoOwnerId"\s*:\s*"?(?P<uid>\d+)"?',
webpage, 'video uid')
title = self._search_regex(r'<title>([^<]+)<', webpage, 'title')
return {
# I have no idea what these params mean but it at least seems to work
'url': 'https://cloud.video.taobao.com/play/u/%s/p/1/e/6/t/1/%s.mp4' % (uid, vid),
'id': vid,
'title': title,
}
class TbcnIE(InfoExtractor):
IE_NAME = 'tbcn:product'
_VALID_URL = r'/https?:\/\/(?:(?:www|[a-z]{2})\.)?(?:m\.)?tb\.cn\/h\.(?P<id>.*)\?.*m\.)?tb\.cn\/h\.(?P<id>.*)\?.*/'
_LOGIN_URL = 'https://login.taobao.com/member/login.jhtml'
_TESTS = [{
'url': 'https://item.taobao.com/item.htm?id=656308694954',
'info_dict': {
'id': '656308694954',
'ext': 'mp4',
'title': 'Video title goes here',
'thumbnail': r're:^https?://.*\.jpg$',
# TODO more properties, either as:
# * A value
# * MD5 checksum; start the string with md5:
# * A regular expression; start the string with re:
# * Any Python type (for example int or float)
}
}]
def _real_extract(self, url):
pid = self._match_id(url)
webpage, urlh = self._download_webpage_handle(url, pid)
visitor_url = urlh.geturl()
if 'login.jhtml' in visitor_url:
raise ExtractorError(
'Lỗi đăng nhập Taobao - Cookies Error - Vui lòng báo lỗi cho hỗ trợ @cpanel10x',
expected=True)
if 'detail.tmall.com' in visitor_url:
vid = self._search_regex(
r'"imgVedioID"\s*:\s*"?(\d+)"?',
webpage, 'video id')
uid = self._search_regex(
r'"userId"\s*:\s*"?(?P<uid>\d+)"?',
webpage, 'video uid')
title = self._search_regex(r'<title>([^<]+)<', webpage, 'title')
elif 'item.taobao.com' in visitor_url:
vid = self._search_regex(
r'"videoId"\s*:\s*"?(\d+)"?',
webpage, 'video id')
uid = self._search_regex(
r'"videoOwnerId"\s*:\s*"?(?P<uid>\d+)"?',
webpage, 'video uid')
title = self._search_regex(r'<title>([^<]+)<', webpage, 'title')
return {
# I have no idea what these params mean but it at least seems to work
'url': 'https://cloud.video.taobao.com/play/u/%s/p/1/e/6/t/1/%s.mp4' % (uid, vid),
'id': vid,
'title': title,
}
class TaobaoWorldIE(InfoExtractor):
IE_NAME = 'taobaoworld:product'
_VALID_URL = r'https?:\/\/(?:(?:www|[a-z]{2})\.)?world\.taobao\.com\/item\/(?P<id>\d+)\.htm'
_LOGIN_URL = 'https://login.taobao.com/member/login.jhtml'
_TESTS = [{
'url': 'https://world.taobao.com/item/643681750378.htm',
'info_dict': {
'id': '643681750378',
'ext': 'mp4',
'title': 'Video title goes here',
'thumbnail': r're:^https?://.*\.jpg$',
# TODO more properties, either as:
# * A value
# * MD5 checksum; start the string with md5:
# * A regular expression; start the string with re:
# * Any Python type (for example int or float)
}
}]
def _real_extract(self, url):
pid = self._match_id(url)
webpage, urlh = self._download_webpage_handle(url, pid)
visitor_url = urlh.geturl()
if 'login.jhtml' in visitor_url:
raise ExtractorError(
'Lỗi đăng nhập Taobao - Cookies Error - Vui lòng báo lỗi cho hỗ trợ @cpanel10x',
expected=True)
videoURL = self._search_regex(
r'"videoUrl"\s*:\s*"?(\S+)"}',
webpage, 'video url', default=None)
if not videoURL:
videoURL='http://bo.vutn.net/no-video.mp4'
uid = self._search_regex(
r'"userId"\s*:\s*"?(?P<uid>\d+)"?',
webpage, 'user id', default=None)
if not uid:
raise ExtractorError(
'Không thể lấy video/ảnh, vui lòng kiểm tra lại liên kết hoặc liên hệ hỗ trợ',
expected=True)
urlthumb = self._search_regex(
r'"images"\s*:\s*(?P<urlthumb>"?\S+\"\])',
webpage, 'imglist', default=None)
title = self._search_regex(r'<title>([^<]+)<', webpage, 'title')
thumb = []
listthumb = json.loads(urlthumb)
for i in range(len(listthumb)):
thumb.append({
'url': listthumb[i],
})
return {
# I have no idea what these params mean but it at least seems to work
'url': videoURL,
'id': uid,
'title': title,
'thumbnails': thumb,
}
class Ali1688IE(InfoExtractor):
IE_NAME = 'ali1688:product'
_VALID_URL = r'https?:\/\/(?:(?:www|[a-z]{2})\.)?(?:detail|m)\.1688\.com\/offer\/(?P<id>\d+)\.html'
_LOGIN_URL = 'https://login.taobao.com/member/login.jhtml'
_TESTS = [{
'url': 'https://m.1688.com/offer/594689528709.html',
'info_dict': {
'id': '594689528709',
'ext': 'mp4',
'title': 'Video title goes here',
'thumbnail': r're:^https?://.*\.jpg$',
# TODO more properties, either as:
# * A value
# * MD5 checksum; start the string with md5:
# * A regular expression; start the string with re:
# * Any Python type (for example int or float)
}
}]
def _real_extract(self, url):
pid = self._match_id(url)
webpage, urlh = self._download_webpage_handle(url, pid)
visitor_url = urlh.geturl()
#debug print('visitor url %s' % visitor_url)
uid = self._search_regex(
r'"videoId":(?P<uid>\d+)',
webpage, 'video id')
videoURL = ''
#debug print('uid is %s' % uid)
if uid == '0':
videoURL='http://bo.vutn.net/no-video.mp4'
else:
videoURL = self._search_regex(
r'"videoUrl":"(?P<videoUrl>.+?)"',
webpage, 'video url', default=None)
urlthumb = self._search_regex(
r'"offerImgList"\s*:\s*(?P<urlthumb>\["?\S+\"\])',
webpage, 'imglist')
thumb = []
listthumb = json.loads(urlthumb)
for i in range(len(listthumb)):
thumb.append({
'url': listthumb[i],
})
title = self._search_regex(r'<title>([^<]+)<', webpage, 'title')
return {
# I have no idea what these params mean but it at least seems to work
'url': videoURL,
'id': uid,
'title': title,
'thumbnails': thumb,
}
| 39.25
| 119
| 0.506227
| 1,237
| 10,519
| 4.192401
| 0.151172
| 0.050135
| 0.075202
| 0.080216
| 0.861743
| 0.830698
| 0.814886
| 0.804859
| 0.785577
| 0.769958
| 0
| 0.025165
| 0.323795
| 10,519
| 267
| 120
| 39.397004
| 0.703922
| 0.126533
| 0
| 0.764706
| 0
| 0.036199
| 0.320297
| 0.116015
| 0
| 0
| 0
| 0.003745
| 0
| 1
| 0.022624
| false
| 0
| 0.013575
| 0
| 0.167421
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
d46593561d87d673d3876da4721157ac7aacc8ed
| 244
|
py
|
Python
|
VSCode_work/chapter5/chapter5_5_4.py
|
yangyahu-1994/Python-Crash-Course
|
6f8ef7fe8466d88931a0d3cc423ba5d966663b9d
|
[
"MIT"
] | 12
|
2020-10-22T14:03:27.000Z
|
2022-03-28T08:14:22.000Z
|
VSCode_work/chapter5/chapter5_5_4.py
|
yangyahu-1994/Python-Crash-Course
|
6f8ef7fe8466d88931a0d3cc423ba5d966663b9d
|
[
"MIT"
] | null | null | null |
VSCode_work/chapter5/chapter5_5_4.py
|
yangyahu-1994/Python-Crash-Course
|
6f8ef7fe8466d88931a0d3cc423ba5d966663b9d
|
[
"MIT"
] | 9
|
2020-12-22T10:22:12.000Z
|
2022-03-28T08:14:53.000Z
|
alien_color = 'green'
if alien_color == 'green':
print("You get 5 points.")
else:
print("\nYou get 10 points.")
alien_color = 'yellow'
if alien_color == 'green':
print("You get 5 points.")
else:
print("\nYou get 10 points.")
| 17.428571
| 33
| 0.627049
| 36
| 244
| 4.138889
| 0.361111
| 0.268456
| 0.302013
| 0.228188
| 0.791946
| 0.791946
| 0.791946
| 0.791946
| 0.791946
| 0.791946
| 0
| 0.031088
| 0.209016
| 244
| 14
| 34
| 17.428571
| 0.740933
| 0
| 0
| 0.8
| 0
| 0
| 0.387755
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.4
| 0
| 0
| 0
| null | 1
| 1
| 1
| 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
| 9
|
d470a1de6b5ba86e7a7f7c163885d3267a68ae5b
| 58,743
|
py
|
Python
|
lang/python/github/com/metaprov/modelaapi/services/common/v1/common_pb2.py
|
metaprov/modeldapi
|
ee05693832051dcd990ee4f061715d7ae0787340
|
[
"Apache-2.0"
] | null | null | null |
lang/python/github/com/metaprov/modelaapi/services/common/v1/common_pb2.py
|
metaprov/modeldapi
|
ee05693832051dcd990ee4f061715d7ae0787340
|
[
"Apache-2.0"
] | null | null | null |
lang/python/github/com/metaprov/modelaapi/services/common/v1/common_pb2.py
|
metaprov/modeldapi
|
ee05693832051dcd990ee4f061715d7ae0787340
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: github.com/metaprov/modelaapi/services/common/v1/common.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='github.com/metaprov/modelaapi/services/common/v1/common.proto',
package='github.com.metaprov.modelaapi.services.common.v1',
syntax='proto3',
serialized_options=b'Z0github.com/metaprov/modelaapi/services/common/v1',
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n=github.com/metaprov/modelaapi/services/common/v1/common.proto\x12\x30github.com.metaprov.modelaapi.services.common.v1\"\xc4\x02\n\x0e\x44\x61tasetProfile\x12\x0c\n\x04\x63ols\x18\x01 \x01(\x05\x12\x0c\n\x04rows\x18\x02 \x01(\x05\x12\x10\n\x08\x66ilesize\x18\x03 \x01(\x05\x12\x11\n\timbalance\x18\x04 \x01(\x08\x12\x45\n\x05plots\x18\x05 \x03(\x0b\x32\x36.github.com.metaprov.modelaapi.services.common.v1.Plot\x12P\n\x07\x63olumns\x18\x06 \x03(\x0b\x32?.github.com.metaprov.modelaapi.services.common.v1.ColumnProfile\x12J\n\x05table\x18\x07 \x01(\x0b\x32;.github.com.metaprov.modelaapi.services.common.v1.TableView\x12\x0c\n\x04hash\x18\x08 \x01(\t\"\xfa\x01\n\x0cModelProfile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x45\n\x05plots\x18\x02 \x03(\x0b\x32\x36.github.com.metaprov.modelaapi.services.common.v1.Plot\x12\x62\n\nimportance\x18\x03 \x03(\x0b\x32N.github.com.metaprov.modelaapi.services.common.v1.ModelProfile.ImportanceEntry\x1a\x31\n\x0fImportanceEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02:\x02\x38\x01\"f\n\x0f\x46orecastProfile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x45\n\x05plots\x18\x02 \x03(\x0b\x32\x36.github.com.metaprov.modelaapi.services.common.v1.Plot\"\xe8\x01\n\x0cStudyProfile\x12\x45\n\x05plots\x18\x01 \x03(\x0b\x32\x36.github.com.metaprov.modelaapi.services.common.v1.Plot\x12N\n\x06models\x18\x02 \x03(\x0b\x32>.github.com.metaprov.modelaapi.services.common.v1.ModelProfile\x12\x14\n\x0ctrainingHash\x18\x03 \x01(\t\x12\x13\n\x0btestingHash\x18\x04 \x01(\t\x12\x16\n\x0evalidationHash\x18\x05 \x01(\t\"L\n\x04Plot\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05title\x18\x02 \x01(\t\x12\x0b\n\x03img\x18\x03 \x01(\x0c\x12\r\n\x05\x66name\x18\x04 \x01(\t\x12\x0b\n\x03url\x18\x05 \x01(\t\"\xe9\x06\n\rColumnProfile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x63ount\x18\x02 \x01(\x05\x12\x0c\n\x04type\x18\x03 \x01(\t\x12\x0f\n\x07missing\x18\x04 \x01(\x05\x12\x16\n\x0epercentMissing\x18\x05 \x01(\x02\x12\x10\n\x08\x64istinct\x18\x06 \x01(\x05\x12\x0c\n\x04mean\x18\x07 \x01(\x01\x12\x0c\n\x04mode\x18\x08 \x01(\t\x12\x0e\n\x06stddev\x18\t \x01(\x01\x12\x10\n\x08variance\x18\n \x01(\x01\x12\x0b\n\x03min\x18\x0b \x01(\x01\x12\x0b\n\x03max\x18\x0c \x01(\x01\x12\x10\n\x08kurtosis\x18\r \x01(\x01\x12\x10\n\x08skewness\x18\x0e \x01(\x01\x12\x0b\n\x03sum\x18\x0f \x01(\x01\x12\x0b\n\x03mad\x18\x10 \x01(\x01\x12\r\n\x05zeros\x18\x11 \x01(\x01\x12\x0b\n\x03p25\x18\x12 \x01(\x01\x12\x0b\n\x03p50\x18\x13 \x01(\x01\x12\x0b\n\x03p75\x18\x14 \x01(\x01\x12\x0c\n\x04p100\x18\x15 \x01(\x01\x12\x0b\n\x03iqr\x18\x16 \x01(\x01\x12\n\n\x02\x63v\x18\x17 \x01(\x01\x12\x0b\n\x03top\x18\x18 \x01(\x05\x12\x0c\n\x04\x66req\x18\x19 \x01(\x05\x12\x0e\n\x06ignore\x18\x1a \x01(\x08\x12\x0e\n\x06target\x18\x1b \x01(\x08\x12N\n\thistogram\x18\x1c \x01(\x0b\x32;.github.com.metaprov.modelaapi.services.common.v1.Histogram\x12\x0f\n\x07invalid\x18\x1d \x01(\x05\x12\x12\n\nimportance\x18\x1e \x01(\x01\x12\x10\n\x08nullable\x18\x1f \x01(\x08\x12\x17\n\x0fhighCardinality\x18 \x01(\x08\x12!\n\x19highCorrWithOtherFeatures\x18! \x01(\x08\x12\x19\n\x11lowCorrWithTarget\x18\" \x01(\x08\x12\x16\n\x0ehighMissingPct\x18# \x01(\x08\x12\x0e\n\x06skewed\x18$ \x01(\x08\x12\n\n\x02id\x18% \x01(\x08\x12\x10\n\x08\x63onstant\x18& \x01(\x08\x12\x11\n\tduplicate\x18\' \x01(\x08\x12\x10\n\x08reserved\x18( \x01(\x08\x12\x10\n\x08outliers\x18) \x01(\x05\x12\x14\n\x0c\x63ompleteness\x18* \x01(\x01\x12\x1a\n\x12\x64istinctValueCount\x18+ \x01(\x01\x12\x1b\n\x13mostFreqValuesRatio\x18, \x01(\x01\x12\x1a\n\x12indexOfPeculiarity\x18- \x01(\x01\")\n\x0eHistogramValue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\t\n\x01v\x18\x02 \x01(\x02\"]\n\tHistogram\x12P\n\x06values\x18\x01 \x03(\x0b\x32@.github.com.metaprov.modelaapi.services.common.v1.HistogramValue\"\xf6\x02\n\rNamespaceInfo\x12[\n\x04type\x18\x01 \x01(\x0e\x32M.github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.NamespaceType\x12\x0c\n\x04Name\x18\x02 \x01(\t\x12\x10\n\x08\x61\x63\x63ounts\x18\x03 \x01(\x05\x12\x0f\n\x07\x62uckets\x18\x04 \x01(\x05\x12\x0c\n\x04labs\x18\x05 \x01(\x05\x12\x14\n\x0cservingsites\x18\x06 \x01(\x05\x12\x10\n\x08\x64\x61tasets\x18\x07 \x01(\x05\x12\x13\n\x0b\x64\x61tasources\x18\x08 \x01(\x05\x12\x0f\n\x07studies\x18\t \x01(\x05\x12\x0e\n\x06models\x18\n \x01(\x05\"k\n\rNamespaceType\x12\n\n\x06TENANT\x10\x00\x12\x0f\n\x0b\x44\x41TAPRODUCT\x10\x01\x12\x07\n\x03LAB\x10\x02\x12\x0f\n\x0bSERVINGSITE\x10\x03\x12\x10\n\x0cMODELASYSTEM\x10\x04\x12\x11\n\rMODELACATALOG\x10\x05\"\xba\x01\n\tTableView\x12\x0c\n\x04\x63ols\x18\x01 \x03(\t\x12L\n\x04rows\x18\x02 \x03(\x0b\x32>.github.com.metaprov.modelaapi.services.common.v1.TableViewRow\x12Q\n\x08profiles\x18\x03 \x03(\x0b\x32?.github.com.metaprov.modelaapi.services.common.v1.ColumnProfile\"\x1e\n\x0cTableViewRow\x12\x0e\n\x06values\x18\x01 \x03(\tB2Z0github.com/metaprov/modelaapi/services/common/v1b\x06proto3'
)
_NAMESPACEINFO_NAMESPACETYPE = _descriptor.EnumDescriptor(
name='NamespaceType',
full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.NamespaceType',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='TENANT', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='DATAPRODUCT', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='LAB', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='SERVINGSITE', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='MODELASYSTEM', index=4, number=4,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='MODELACATALOG', index=5, number=5,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=2394,
serialized_end=2501,
)
_sym_db.RegisterEnumDescriptor(_NAMESPACEINFO_NAMESPACETYPE)
_DATASETPROFILE = _descriptor.Descriptor(
name='DatasetProfile',
full_name='github.com.metaprov.modelaapi.services.common.v1.DatasetProfile',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='cols', full_name='github.com.metaprov.modelaapi.services.common.v1.DatasetProfile.cols', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='rows', full_name='github.com.metaprov.modelaapi.services.common.v1.DatasetProfile.rows', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='filesize', full_name='github.com.metaprov.modelaapi.services.common.v1.DatasetProfile.filesize', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='imbalance', full_name='github.com.metaprov.modelaapi.services.common.v1.DatasetProfile.imbalance', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='plots', full_name='github.com.metaprov.modelaapi.services.common.v1.DatasetProfile.plots', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='columns', full_name='github.com.metaprov.modelaapi.services.common.v1.DatasetProfile.columns', index=5,
number=6, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='table', full_name='github.com.metaprov.modelaapi.services.common.v1.DatasetProfile.table', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='hash', full_name='github.com.metaprov.modelaapi.services.common.v1.DatasetProfile.hash', index=7,
number=8, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=116,
serialized_end=440,
)
_MODELPROFILE_IMPORTANCEENTRY = _descriptor.Descriptor(
name='ImportanceEntry',
full_name='github.com.metaprov.modelaapi.services.common.v1.ModelProfile.ImportanceEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='github.com.metaprov.modelaapi.services.common.v1.ModelProfile.ImportanceEntry.key', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='value', full_name='github.com.metaprov.modelaapi.services.common.v1.ModelProfile.ImportanceEntry.value', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=b'8\001',
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=644,
serialized_end=693,
)
_MODELPROFILE = _descriptor.Descriptor(
name='ModelProfile',
full_name='github.com.metaprov.modelaapi.services.common.v1.ModelProfile',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='github.com.metaprov.modelaapi.services.common.v1.ModelProfile.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='plots', full_name='github.com.metaprov.modelaapi.services.common.v1.ModelProfile.plots', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='importance', full_name='github.com.metaprov.modelaapi.services.common.v1.ModelProfile.importance', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[_MODELPROFILE_IMPORTANCEENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=443,
serialized_end=693,
)
_FORECASTPROFILE = _descriptor.Descriptor(
name='ForecastProfile',
full_name='github.com.metaprov.modelaapi.services.common.v1.ForecastProfile',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='github.com.metaprov.modelaapi.services.common.v1.ForecastProfile.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='plots', full_name='github.com.metaprov.modelaapi.services.common.v1.ForecastProfile.plots', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=695,
serialized_end=797,
)
_STUDYPROFILE = _descriptor.Descriptor(
name='StudyProfile',
full_name='github.com.metaprov.modelaapi.services.common.v1.StudyProfile',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='plots', full_name='github.com.metaprov.modelaapi.services.common.v1.StudyProfile.plots', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='models', full_name='github.com.metaprov.modelaapi.services.common.v1.StudyProfile.models', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='trainingHash', full_name='github.com.metaprov.modelaapi.services.common.v1.StudyProfile.trainingHash', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='testingHash', full_name='github.com.metaprov.modelaapi.services.common.v1.StudyProfile.testingHash', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='validationHash', full_name='github.com.metaprov.modelaapi.services.common.v1.StudyProfile.validationHash', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=800,
serialized_end=1032,
)
_PLOT = _descriptor.Descriptor(
name='Plot',
full_name='github.com.metaprov.modelaapi.services.common.v1.Plot',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='github.com.metaprov.modelaapi.services.common.v1.Plot.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='title', full_name='github.com.metaprov.modelaapi.services.common.v1.Plot.title', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='img', full_name='github.com.metaprov.modelaapi.services.common.v1.Plot.img', index=2,
number=3, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=b"",
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='fname', full_name='github.com.metaprov.modelaapi.services.common.v1.Plot.fname', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='url', full_name='github.com.metaprov.modelaapi.services.common.v1.Plot.url', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1034,
serialized_end=1110,
)
_COLUMNPROFILE = _descriptor.Descriptor(
name='ColumnProfile',
full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='count', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.count', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='type', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.type', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='missing', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.missing', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='percentMissing', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.percentMissing', index=4,
number=5, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='distinct', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.distinct', index=5,
number=6, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='mean', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.mean', index=6,
number=7, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='mode', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.mode', index=7,
number=8, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='stddev', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.stddev', index=8,
number=9, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='variance', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.variance', index=9,
number=10, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='min', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.min', index=10,
number=11, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='max', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.max', index=11,
number=12, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='kurtosis', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.kurtosis', index=12,
number=13, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='skewness', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.skewness', index=13,
number=14, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='sum', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.sum', index=14,
number=15, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='mad', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.mad', index=15,
number=16, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='zeros', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.zeros', index=16,
number=17, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='p25', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.p25', index=17,
number=18, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='p50', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.p50', index=18,
number=19, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='p75', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.p75', index=19,
number=20, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='p100', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.p100', index=20,
number=21, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='iqr', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.iqr', index=21,
number=22, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='cv', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.cv', index=22,
number=23, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='top', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.top', index=23,
number=24, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='freq', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.freq', index=24,
number=25, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='ignore', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.ignore', index=25,
number=26, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='target', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.target', index=26,
number=27, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='histogram', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.histogram', index=27,
number=28, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='invalid', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.invalid', index=28,
number=29, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='importance', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.importance', index=29,
number=30, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='nullable', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.nullable', index=30,
number=31, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='highCardinality', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.highCardinality', index=31,
number=32, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='highCorrWithOtherFeatures', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.highCorrWithOtherFeatures', index=32,
number=33, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lowCorrWithTarget', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.lowCorrWithTarget', index=33,
number=34, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='highMissingPct', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.highMissingPct', index=34,
number=35, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='skewed', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.skewed', index=35,
number=36, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='id', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.id', index=36,
number=37, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='constant', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.constant', index=37,
number=38, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='duplicate', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.duplicate', index=38,
number=39, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='reserved', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.reserved', index=39,
number=40, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='outliers', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.outliers', index=40,
number=41, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='completeness', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.completeness', index=41,
number=42, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='distinctValueCount', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.distinctValueCount', index=42,
number=43, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='mostFreqValuesRatio', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.mostFreqValuesRatio', index=43,
number=44, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='indexOfPeculiarity', full_name='github.com.metaprov.modelaapi.services.common.v1.ColumnProfile.indexOfPeculiarity', index=44,
number=45, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1113,
serialized_end=1986,
)
_HISTOGRAMVALUE = _descriptor.Descriptor(
name='HistogramValue',
full_name='github.com.metaprov.modelaapi.services.common.v1.HistogramValue',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='github.com.metaprov.modelaapi.services.common.v1.HistogramValue.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='v', full_name='github.com.metaprov.modelaapi.services.common.v1.HistogramValue.v', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1988,
serialized_end=2029,
)
_HISTOGRAM = _descriptor.Descriptor(
name='Histogram',
full_name='github.com.metaprov.modelaapi.services.common.v1.Histogram',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='values', full_name='github.com.metaprov.modelaapi.services.common.v1.Histogram.values', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2031,
serialized_end=2124,
)
_NAMESPACEINFO = _descriptor.Descriptor(
name='NamespaceInfo',
full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.type', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='Name', full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.Name', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='accounts', full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.accounts', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='buckets', full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.buckets', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='labs', full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.labs', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='servingsites', full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.servingsites', index=5,
number=6, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='datasets', full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.datasets', index=6,
number=7, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='datasources', full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.datasources', index=7,
number=8, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='studies', full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.studies', index=8,
number=9, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='models', full_name='github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo.models', index=9,
number=10, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
_NAMESPACEINFO_NAMESPACETYPE,
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2127,
serialized_end=2501,
)
_TABLEVIEW = _descriptor.Descriptor(
name='TableView',
full_name='github.com.metaprov.modelaapi.services.common.v1.TableView',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='cols', full_name='github.com.metaprov.modelaapi.services.common.v1.TableView.cols', index=0,
number=1, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='rows', full_name='github.com.metaprov.modelaapi.services.common.v1.TableView.rows', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='profiles', full_name='github.com.metaprov.modelaapi.services.common.v1.TableView.profiles', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2504,
serialized_end=2690,
)
_TABLEVIEWROW = _descriptor.Descriptor(
name='TableViewRow',
full_name='github.com.metaprov.modelaapi.services.common.v1.TableViewRow',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='values', full_name='github.com.metaprov.modelaapi.services.common.v1.TableViewRow.values', index=0,
number=1, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=2692,
serialized_end=2722,
)
_DATASETPROFILE.fields_by_name['plots'].message_type = _PLOT
_DATASETPROFILE.fields_by_name['columns'].message_type = _COLUMNPROFILE
_DATASETPROFILE.fields_by_name['table'].message_type = _TABLEVIEW
_MODELPROFILE_IMPORTANCEENTRY.containing_type = _MODELPROFILE
_MODELPROFILE.fields_by_name['plots'].message_type = _PLOT
_MODELPROFILE.fields_by_name['importance'].message_type = _MODELPROFILE_IMPORTANCEENTRY
_FORECASTPROFILE.fields_by_name['plots'].message_type = _PLOT
_STUDYPROFILE.fields_by_name['plots'].message_type = _PLOT
_STUDYPROFILE.fields_by_name['models'].message_type = _MODELPROFILE
_COLUMNPROFILE.fields_by_name['histogram'].message_type = _HISTOGRAM
_HISTOGRAM.fields_by_name['values'].message_type = _HISTOGRAMVALUE
_NAMESPACEINFO.fields_by_name['type'].enum_type = _NAMESPACEINFO_NAMESPACETYPE
_NAMESPACEINFO_NAMESPACETYPE.containing_type = _NAMESPACEINFO
_TABLEVIEW.fields_by_name['rows'].message_type = _TABLEVIEWROW
_TABLEVIEW.fields_by_name['profiles'].message_type = _COLUMNPROFILE
DESCRIPTOR.message_types_by_name['DatasetProfile'] = _DATASETPROFILE
DESCRIPTOR.message_types_by_name['ModelProfile'] = _MODELPROFILE
DESCRIPTOR.message_types_by_name['ForecastProfile'] = _FORECASTPROFILE
DESCRIPTOR.message_types_by_name['StudyProfile'] = _STUDYPROFILE
DESCRIPTOR.message_types_by_name['Plot'] = _PLOT
DESCRIPTOR.message_types_by_name['ColumnProfile'] = _COLUMNPROFILE
DESCRIPTOR.message_types_by_name['HistogramValue'] = _HISTOGRAMVALUE
DESCRIPTOR.message_types_by_name['Histogram'] = _HISTOGRAM
DESCRIPTOR.message_types_by_name['NamespaceInfo'] = _NAMESPACEINFO
DESCRIPTOR.message_types_by_name['TableView'] = _TABLEVIEW
DESCRIPTOR.message_types_by_name['TableViewRow'] = _TABLEVIEWROW
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
DatasetProfile = _reflection.GeneratedProtocolMessageType('DatasetProfile', (_message.Message,), {
'DESCRIPTOR' : _DATASETPROFILE,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.DatasetProfile)
})
_sym_db.RegisterMessage(DatasetProfile)
ModelProfile = _reflection.GeneratedProtocolMessageType('ModelProfile', (_message.Message,), {
'ImportanceEntry' : _reflection.GeneratedProtocolMessageType('ImportanceEntry', (_message.Message,), {
'DESCRIPTOR' : _MODELPROFILE_IMPORTANCEENTRY,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.ModelProfile.ImportanceEntry)
})
,
'DESCRIPTOR' : _MODELPROFILE,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.ModelProfile)
})
_sym_db.RegisterMessage(ModelProfile)
_sym_db.RegisterMessage(ModelProfile.ImportanceEntry)
ForecastProfile = _reflection.GeneratedProtocolMessageType('ForecastProfile', (_message.Message,), {
'DESCRIPTOR' : _FORECASTPROFILE,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.ForecastProfile)
})
_sym_db.RegisterMessage(ForecastProfile)
StudyProfile = _reflection.GeneratedProtocolMessageType('StudyProfile', (_message.Message,), {
'DESCRIPTOR' : _STUDYPROFILE,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.StudyProfile)
})
_sym_db.RegisterMessage(StudyProfile)
Plot = _reflection.GeneratedProtocolMessageType('Plot', (_message.Message,), {
'DESCRIPTOR' : _PLOT,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.Plot)
})
_sym_db.RegisterMessage(Plot)
ColumnProfile = _reflection.GeneratedProtocolMessageType('ColumnProfile', (_message.Message,), {
'DESCRIPTOR' : _COLUMNPROFILE,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.ColumnProfile)
})
_sym_db.RegisterMessage(ColumnProfile)
HistogramValue = _reflection.GeneratedProtocolMessageType('HistogramValue', (_message.Message,), {
'DESCRIPTOR' : _HISTOGRAMVALUE,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.HistogramValue)
})
_sym_db.RegisterMessage(HistogramValue)
Histogram = _reflection.GeneratedProtocolMessageType('Histogram', (_message.Message,), {
'DESCRIPTOR' : _HISTOGRAM,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.Histogram)
})
_sym_db.RegisterMessage(Histogram)
NamespaceInfo = _reflection.GeneratedProtocolMessageType('NamespaceInfo', (_message.Message,), {
'DESCRIPTOR' : _NAMESPACEINFO,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.NamespaceInfo)
})
_sym_db.RegisterMessage(NamespaceInfo)
TableView = _reflection.GeneratedProtocolMessageType('TableView', (_message.Message,), {
'DESCRIPTOR' : _TABLEVIEW,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.TableView)
})
_sym_db.RegisterMessage(TableView)
TableViewRow = _reflection.GeneratedProtocolMessageType('TableViewRow', (_message.Message,), {
'DESCRIPTOR' : _TABLEVIEWROW,
'__module__' : 'github.com.metaprov.modelaapi.services.common.v1.common_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.services.common.v1.TableViewRow)
})
_sym_db.RegisterMessage(TableViewRow)
DESCRIPTOR._options = None
_MODELPROFILE_IMPORTANCEENTRY._options = None
# @@protoc_insertion_point(module_scope)
| 53.5
| 4,912
| 0.759376
| 7,642
| 58,743
| 5.57027
| 0.052342
| 0.052622
| 0.083466
| 0.094719
| 0.822825
| 0.794987
| 0.786929
| 0.783053
| 0.778942
| 0.769428
| 0
| 0.040525
| 0.115333
| 58,743
| 1,097
| 4,913
| 53.548769
| 0.778595
| 0.024939
| 0
| 0.708616
| 1
| 0.003872
| 0.235486
| 0.206633
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.018393
| 0
| 0.018393
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
00f8bd1bdbd6a530e6abd504790d7e727e868047
| 11,635
|
py
|
Python
|
test/rest_basic/test_message_logic.py
|
amstee/NeoRestAPI
|
9c0e28a82ae0d23bab03993340df73383a9454af
|
[
"Apache-2.0"
] | 3
|
2018-09-20T16:27:39.000Z
|
2019-10-29T23:35:14.000Z
|
test/rest_basic/test_message_logic.py
|
amstee/NeoRestAPI
|
9c0e28a82ae0d23bab03993340df73383a9454af
|
[
"Apache-2.0"
] | 1
|
2021-02-08T20:23:30.000Z
|
2021-02-08T20:23:30.000Z
|
test/rest_basic/test_message_logic.py
|
amstee/NeoRestAPI
|
9c0e28a82ae0d23bab03993340df73383a9454af
|
[
"Apache-2.0"
] | null | null | null |
import unittest
import json
from config.loader import neo_config
from api import NeoAPI
from config.database import db
from models.User import User as UserModel
from models.UserToCircle import UserToCircle
from models.Conversation import Conversation
from models.Circle import Circle
from models.UserToConversation import UserToConversation
from utils.testutils import authenticate_user
from gevent import monkey
monkey.patch_all()
class TestFirstMessageToDeviceSend(unittest.TestCase):
def setUp(self):
neo_config.load_config()
neo_config.set_project_variables()
neo = NeoAPI(neo_config)
self.api = neo.activate_testing()
self.user1 = db.session.query(UserModel).filter(UserModel.email == "testmessage@test.com").first()
if self.user1 is None:
self.user1 = UserModel(email="testmessage@test.com", password="test", first_name="firstname",
last_name="lastname", birthday="1995-12-12")
self.user2 = db.session.query(UserModel).filter(UserModel.email == "testmessage2@test.com").first()
if self.user2 is None:
self.user2 = UserModel(email="testmessage2@test.com", password="test", first_name="firstname",
last_name="lastname", birthday="1111-11-11")
self.circle = Circle(name="Mamie")
self.linkCircle = UserToCircle(user=self.user1, circle=self.circle)
self.linkCircle2 = UserToCircle(user=self.user2, circle=self.circle)
db.session.commit()
self.token1 = authenticate_user(self.api, self.user1, "test")
self.token2 = authenticate_user(self.api, self.user2, "test")
self.tokenAdmin = authenticate_user(self.api, "contact.projetneo@gmail.com", "PapieNeo2019")
def test_valid_first_message(self):
json_data = {
"token": self.token1,
"circle_id": self.circle.id,
"text_message": "Salut mamie"
}
response = self.api.post('/message/device/first-message',
data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code == 200
assert response_json['success']
assert len(self.circle.conversations) == 1
assert self.circle.conversations[0].device_access
assert self.circle.conversations[0].name == "Mamie"
assert self.circle.conversations[0].messages[0].text_content == "Salut mamie"
def test_invalid_circle_id(self):
json_data = {
"token": self.token1,
"circle_id": 200000,
"text_message": "Salut mamie"
}
response = self.api.post('/message/device/first-message',
data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code != 200
assert not response_json['success']
def test_invalid_user(self):
json_data = {
"token": self.tokenAdmin,
"circle_id": self.circle.id,
"text_message": "Salut mamie"
}
response = self.api.post('/message/device/first-message',
data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code == 403
assert not response_json['success']
def test_missing_parameter(self):
json_data = {
"token": self.token1,
"text_message": "Salut mamie"
}
response = self.api.post('/message/device/first-message',
data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code != 200
assert not response_json['success']
class TestFirstMessageSend(unittest.TestCase):
def setUp(self):
neo_config.load_config()
neo_config.set_project_variables()
neo = NeoAPI(neo_config)
self.api = neo.activate_testing()
self.user1 = db.session.query(UserModel).filter(UserModel.email == "testmessage@test.com").first()
if self.user1 is None:
self.user1 = UserModel(email="testmessage@test.com", password="test", first_name="firstname",
last_name="lastname", birthday="1995-12-12")
self.user2 = db.session.query(UserModel).filter(UserModel.email == "testmessage2@test.com").first()
if self.user2 is None:
self.user2 = UserModel(email="testmessage2@test.com", password="test", first_name="firstname",
last_name="lastname", birthday="1111-11-11")
self.circle = Circle(name="Mamie")
self.linkCircle = UserToCircle(user=self.user1, circle=self.circle)
self.linkCircle2 = UserToCircle(user=self.user2, circle=self.circle)
db.session.commit()
self.token1 = authenticate_user(self.api, self.user1, "test")
self.token2 = authenticate_user(self.api, self.user2, "test")
self.tokenAdmin = authenticate_user(self.api, "contact.projetneo@gmail.com", "PapieNeo2019")
def test_valid_message_send(self):
json_data = {
"token": self.token1,
"circle_id": self.circle.id,
"email": self.user2.email,
"text_message": "Salut frangin"
}
response = self.api.post('/message/first-message', data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code == 200
assert response_json['success']
assert len(self.circle.conversations) == 1
assert len(self.circle.conversations[0].messages) == 1
assert self.circle.conversations[0].messages[0].text_content == "Salut frangin"
def test_invalid_user(self):
json_data = {
"token": self.tokenAdmin,
"circle_id": self.circle.id,
"email": self.user2.email,
"text_message": "Salut frangin"
}
response = self.api.post('/message/first-message', data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code == 403
assert not response_json['success']
def test_missing_parameter(self):
json_data = {
"token": self.token1,
"email": self.user2.email,
"text_message": "Salut frangin"
}
response = self.api.post('/message/first-message', data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code != 200
assert not response_json['success']
def test_invalid_circle(self):
json_data = {
"token": self.tokenAdmin,
"circle_id": 2000000,
"email": self.user2.email,
"text_message": "Salut frangin"
}
response = self.api.post('/message/first-message', data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code != 200
assert not response_json['success']
def test_invalid_dest(self):
json_data = {
"token": self.token1,
"circle_id": self.circle.id,
"email": "contact.projetneo@gmail.com",
"text_message": "Salut frangin"
}
response = self.api.post('/message/first-message', data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code == 403
assert not response_json['success']
class TestMessageSend(unittest.TestCase):
def setUp(self):
neo_config.load_config()
neo_config.set_project_variables()
neo = NeoAPI(neo_config)
self.api = neo.activate_testing()
self.user1 = db.session.query(UserModel).filter(UserModel.email == "testmessage@test.com").first()
if self.user1 is None:
self.user1 = UserModel(email="testmessage@test.com", password="test", first_name="firstname",
last_name="lastname", birthday="1995-12-12")
self.user2 = db.session.query(UserModel).filter(UserModel.email == "testmessage2@test.com").first()
if self.user2 is None:
self.user2 = UserModel(email="testmessage2@test.com", password="test", first_name="firstname",
last_name="lastname", birthday="1111-11-11")
self.circle = Circle(name="Mamie")
self.linkCircle = UserToCircle(user=self.user1, circle=self.circle)
self.linkCircle2 = UserToCircle(user=self.user2, circle=self.circle)
self.conversation = Conversation(circle=self.circle)
self.linkConversation = UserToConversation(user=self.user1, conversation=self.conversation, privilege="ADMIN")
self.linkConversation2 = UserToConversation(user=self.user2,
conversation=self.conversation, privilege="STANDARD")
db.session.commit()
self.token1 = authenticate_user(self.api, self.user1, "test")
self.token2 = authenticate_user(self.api, self.user2, "test")
self.tokenAdmin = authenticate_user(self.api, "contact.projetneo@gmail.com", "PapieNeo2019")
def test_valid_message_send(self):
json_data = {
"token": self.token1,
"conversation_id": self.conversation.id,
"text_message": "Salut frangin"
}
response = self.api.post('/message/send', data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code == 200
assert response_json['success']
assert len(self.conversation.messages) == 1
assert self.conversation.messages[0].text_content == "Salut frangin"
def test_invalid_user(self):
json_data = {
"token": self.tokenAdmin,
"conversation_id": self.conversation.id,
"text_message": "Salut frangin"
}
response = self.api.post('/message/send', data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code == 404
assert not response_json['success']
def test_invalid_conversation(self):
json_data = {
"token": self.token1,
"conversation_id": 200000,
"text_message": "Salut frangin"
}
response = self.api.post('/message/send', data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code != 200
assert not response_json['success']
def test_missing_parameter(self):
json_data = {
"token": self.token1,
"text_message": "Salut frangin"
}
response = self.api.post('/message/send', data=json.dumps(json_data), content_type='application/json')
response_json = json.loads(response.data)
assert response.status_code != 200
assert not response_json['success']
| 47.489796
| 120
| 0.621143
| 1,284
| 11,635
| 5.488318
| 0.091122
| 0.029516
| 0.022137
| 0.031361
| 0.881936
| 0.871009
| 0.866042
| 0.866042
| 0.843763
| 0.843763
| 0
| 0.022222
| 0.261281
| 11,635
| 244
| 121
| 47.684426
| 0.797673
| 0
| 0
| 0.777778
| 0
| 0
| 0.154684
| 0.040383
| 0
| 0
| 0
| 0
| 0.155556
| 1
| 0.071111
| false
| 0.026667
| 0.053333
| 0
| 0.137778
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
2e2a47f91e67be7110cb25aa26a809c53a9dd0ba
| 9,834
|
py
|
Python
|
MLNN.py
|
billybishop21/Algo_Signals_2.0
|
07541de6cdc0de0c050f7c38173ee0ded33a6d19
|
[
"MIT"
] | null | null | null |
MLNN.py
|
billybishop21/Algo_Signals_2.0
|
07541de6cdc0de0c050f7c38173ee0ded33a6d19
|
[
"MIT"
] | null | null | null |
MLNN.py
|
billybishop21/Algo_Signals_2.0
|
07541de6cdc0de0c050f7c38173ee0ded33a6d19
|
[
"MIT"
] | 1
|
2021-10-16T12:48:21.000Z
|
2021-10-16T12:48:21.000Z
|
import pandas as pd
from pathlib import Path
# import tensorflow as tf
from tensorflow.keras.layers import Dense
from tensorflow.keras.models import Sequential
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler,OneHotEncoder
import sqlalchemy
# import h5py
# import hvplot.pandas
# import bokeh
# from holoviews.plotting.links import RangeToolLink
import utils.helpful_functions as hf
# from sklearn.decomposition import PCA
from sklearn.svm import SVC
from sklearn.metrics import confusion_matrix
from sklearn.metrics import balanced_accuracy_score
from sklearn.metrics import classification_report
engine = sqlalchemy.create_engine(hf.db_connection_string)
inspector = sqlalchemy.inspect(engine)
table_names = inspector.get_table_names()
def mlnn(df, output_nodes=None):
# Create a list of categorical variables
categorical_variables = ['Trade Signal']
# Create a OneHotEncoder instance
enc = OneHotEncoder(sparse=False)
# Encode the categorcal variables using OneHotEncoder
encoded_data = enc.fit_transform(df[categorical_variables])
# Create a DataFrame with the encoded variables
encoded_df = pd.DataFrame(
encoded_data,
columns = enc.get_feature_names(categorical_variables)
)
encoded_df.rename(columns={'Trade Signal_-1.0': 'Bearish', 'Trade Signal_0.0': 'None', 'Trade Signal_1.0':'Bullish'}, inplace=True)
# encoded_df.drop(columns='None', inplace=True)
# Define the features set X and the target set y
if output_nodes == 2:
y = encoded_df[['Bearish', 'None', 'Bullish']]
else:
y = encoded_df['Bullish']
output_nodes = 1
X = df.drop(columns=['Trade Signal'])
# Split the preprocessed data into a training and testing dataset
# Assign the function a random_state equal to 1
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=1)
# Create a StandardScaler instance
scaler = StandardScaler()
# Fit the scaler to the features training dataset
X_scaler = scaler.fit(X_train)
# Fit the scaler to the features training dataset
X_train_scaled = X_scaler.transform(X_train)
X_test_scaled = X_scaler.transform(X_test)
# Define the the number of inputs (features) to the model
number_input_features = len(list(X.columns))
# Define the number of hidden nodes for the first hidden layer
hidden_nodes_layer1 = int(round((number_input_features + output_nodes)/2, 0))
# Create the Sequential model instance
nn = Sequential()
# Add the first hidden layer
nn.add(Dense(units=hidden_nodes_layer1, activation="relu", input_dim=number_input_features))
# Add the output layer to the model specifying the number of output neurons and activation function
nn.add(Dense(units=output_nodes, activation="sigmoid"))
# Display the Sequential model summary
nn.summary()
# Compile the Sequential model
nn.compile(loss="binary_crossentropy", optimizer="adam", metrics=["accuracy"])
# Fit the model using 50 epochs and the training data
model = nn.fit(X_train_scaled, y_train, epochs=50, verbose=0)
print("Model Results")
# Evaluate the model loss and accuracy metrics using the evaluate method and the test data
model_loss, model_accuracy = nn.evaluate(X_test_scaled, y_test, verbose=True)
# Display the model loss and accuracy results
print(f"Loss: {model_loss}, Accuracy: {model_accuracy}")
y_pred = nn.predict(X_test_scaled)
# print(y_test)
# print(X_test_scaled)
# print(y_pred)
y_pred_df = pd.DataFrame(y_pred)
# print(y_pred_df.head())
y_test_df = pd.DataFrame(y_test).reset_index(drop=True)
results = pd.concat([y_test_df, y_pred_df], axis=1)
# print(results.head())
results.rename(columns={'Bullish': 'Actual', 0: 'Predictions'}, inplace=True)
# results.to_csv(Path('./Resources/results.csv'))
results['Predictions'] = results['Predictions'].apply(lambda x: int(round(x, 0)))
results['Actual'] = results['Actual'].apply(lambda x: int(round(x, 0)))
# print(results.value_counts())
# print(results)
# print(results['Actual'].value_counts())
# print(results['Predictions'].value_counts())
cm = confusion_matrix(results['Actual'], results['Predictions'])
print(cm, type(cm))
cr = classification_report(results['Actual'], results['Predictions'], zero_division='warn')
print(cr, type(cr))
return
def dlnn(df, output_nodes=None):
# Create a list of categorical variables
categorical_variables = ['Trade Signal']
# Create a OneHotEncoder instance
enc = OneHotEncoder(sparse=False)
# Encode the categorcal variables using OneHotEncoder
encoded_data = enc.fit_transform(df[categorical_variables])
# Create a DataFrame with the encoded variables
encoded_df = pd.DataFrame(
encoded_data,
columns = enc.get_feature_names(categorical_variables)
)
encoded_df.rename(columns={'Trade Signal_-1.0': 'Bearish', 'Trade Signal_0.0': 'None', 'Trade Signal_1.0':'Bullish'}, inplace=True)
encoded_df.drop(columns='None', inplace=True)
# Define the features set X and the target set y
if output_nodes == 2:
y = encoded_df[['Bullish', 'Bearish']]
else:
y = encoded_df['Bullish']
output_nodes = 1
X = df.drop(columns=['Trade Signal'])
# Split the preprocessed data into a training and testing dataset
# Assign the function a random_state equal to 1
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=1)
# Create a StandardScaler instance
scaler = StandardScaler()
# Fit the scaler to the features training dataset
X_scaler = scaler.fit(X_train)
# Fit the scaler to the features training dataset
X_train_scaled = X_scaler.transform(X_train)
X_test_scaled = X_scaler.transform(X_test)
# Define the the number of inputs (features) to the model
number_input_features = len(list(X.columns))
# Define the number of hidden nodes for the first and second hidden layer
hidden_nodes_layer1 = int(round((number_input_features +output_nodes)/2, 0))
hidden_nodes_layer2 = int(round((hidden_nodes_layer1 + output_nodes)/2, 0))
# Create the Sequential model instance
nn = Sequential()
# Add the first hidden layer
nn.add(Dense(units=hidden_nodes_layer1, activation="relu", input_dim=number_input_features))
# Add the second hidden layer
nn.add(Dense(units=hidden_nodes_layer2, activation="relu"))
# Add the output layer to the model specifying the number of output neurons and activation function
nn.add(Dense(units=output_nodes, activation="sigmoid"))
# Display the Sequential model summary
print(nn.summary())
# Compile the Sequential model
nn.compile(loss="binary_crossentropy", optimizer="adam", metrics=["accuracy"])
# Fit the model using 50 epochs and the training data
model = nn.fit(X_train_scaled, y_train, epochs=50, verbose=0)
# Evaluate the model loss and accuracy metrics using the evaluate method and the test data
model_loss, model_accuracy = nn.evaluate(X_test_scaled, y_test, verbose=True)
# Display the model loss and accuracy results
print(f"Loss: {model_loss}, Accuracy: {model_accuracy}")
y_pred = nn.predict(X_test_scaled)
y_pred_df = pd.DataFrame(y_pred)
y_test_df = pd.DataFrame(y_test).reset_index(drop=True)
results = pd.concat([y_test_df, y_pred_df], axis=1)
results.rename(columns={'Bullish': 'Actual', 0: 'Predictions'}, inplace=True)
results['Predictions'] = results['Predictions'].apply(lambda x: int(round(x, 0)))
results['Actual'] = results['Actual'].apply(lambda x: int(round(x, 0)))
# print(results)
# print(confusion_matrix(y_test, y_pred))
# print(classification_report(y_test, y_pred, zero_division='warn'))
cm = confusion_matrix(results['Actual'], results['Predictions'])
print(cm, type(cm))
cr = classification_report(results['Actual'], results['Predictions'], zero_division='warn')
print(cr, type(cr))
return
def svc(df):
# Create a list of categorical variables
categorical_variables = ['Trade Signal']
# Create a OneHotEncoder instance
enc = OneHotEncoder(sparse=False)
# Encode the categorcal variables using OneHotEncoder
encoded_data = enc.fit_transform(df[categorical_variables])
# Create a DataFrame with the encoded variables
encoded_df = pd.DataFrame(
encoded_data,
columns = enc.get_feature_names(categorical_variables)
)
encoded_df.rename(columns={'Trade Signal_-1.0': 'Bearish', 'Trade Signal_0.0': 'None', 'Trade Signal_1.0':'Bullish'}, inplace=True)
encoded_df.drop(columns='None', inplace=True)
# Define the features set X and the target set y
y = encoded_df['Bullish']
X = df.drop(columns=['Trade Signal'])
# y = df["Trade Signal"]
model = SVC(kernel='linear')
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=1)
# print(X.tail())
scaler = StandardScaler()
X_scaler = scaler.fit(X_train)
X_train_scaled = X_scaler.transform(X_train)
X_test_scaled = X_scaler.transform(X_test)
# model = SVC(kernel='linear')
model.fit(X_train_scaled, y_train)
y_pred = model.predict(X_test_scaled)
results = pd.DataFrame({"Predictions": y_pred, "Actual":y_test}).reset_index(drop=True)
# print(results)
# print(confusion_matrix(y_test, y_pred))
# print(classification_report(y_test, y_pred, zero_division='warn'))
cm = confusion_matrix(results['Actual'], results['Predictions'])
print(cm, type(cm))
cr = classification_report(results['Actual'], results['Predictions'], zero_division='warn')
print(cr, type(cr))
return
| 41.493671
| 135
| 0.71446
| 1,361
| 9,834
| 4.982366
| 0.13299
| 0.012535
| 0.0146
| 0.011503
| 0.831441
| 0.828049
| 0.814629
| 0.807845
| 0.802389
| 0.802389
| 0
| 0.007305
| 0.178666
| 9,834
| 236
| 136
| 41.669492
| 0.83224
| 0.306793
| 0
| 0.751938
| 0
| 0
| 0.115658
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.023256
| false
| 0
| 0.093023
| 0
| 0.139535
| 0.077519
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
2e39d9dab0e286e805715035597f03de08f7d904
| 9,264
|
py
|
Python
|
vanilla_cmu/net/utils/graph.py
|
ericchen321/DMGNN
|
759adf63d97d8b69fb30ccaaed0332e66699a1fa
|
[
"MIT"
] | 100
|
2020-03-15T17:48:44.000Z
|
2022-03-22T18:26:47.000Z
|
vanilla_cmu/net/utils/graph.py
|
ericchen321/DMGNN
|
759adf63d97d8b69fb30ccaaed0332e66699a1fa
|
[
"MIT"
] | 11
|
2020-03-30T11:55:45.000Z
|
2021-08-31T04:54:18.000Z
|
vanilla_cmu/net/utils/graph.py
|
ericchen321/DMGNN
|
759adf63d97d8b69fb30ccaaed0332e66699a1fa
|
[
"MIT"
] | 23
|
2020-03-22T21:55:25.000Z
|
2022-03-11T20:36:36.000Z
|
import numpy as np
class Graph_J():
def __init__(self, layout='cmu', strategy='uniform', max_hop=1, dilation=1):
self.max_hop = max_hop
self.dilation = dilation
self.get_edge(layout)
self.hop_dis = get_hop_distance(self.num_node, self.edge, max_hop=max_hop)
self.get_adjacency(strategy)
def __str__(self):
return self.A_j
def get_edge(self, layout):
if layout == 'cmu':
self.num_node = 26
self_link = [(i, i) for i in range(self.num_node)]
# neighbor_link_ = [(1,2),(2,3),(3,4),(4,5),(1,6),(6,7),(7,8),(8,9),
# (1,10),(10,11),(11,12),(12,13),(13,14),(14,15),
# (12,16),(16,17),(17,18),(18,19),(19,20),(18,21),
# (12,22),(22,23),(23,24),(24,25),(25,26),(24,27)]
neighbor_link_ = [(1,2),(2,3),(3,4),(5,6),(6,7),(7,8),(1,9),(5,9),
(9,10),(10,11),(11,12),(12,13),(13,14),
(11,15),(15,16),(16,17),(17,18),(18,19),(17,20),
(12,21),(21,22),(22,23),(23,24),(24,25),(23,26)]
neighbor_link = [(i-1,j-1) for (i,j) in neighbor_link_]
self.edge = self_link + neighbor_link
self.center = 10-1
def get_adjacency(self, strategy):
valid_hop = range(0, self.max_hop + 1, self.dilation)
adjacency = np.zeros((self.num_node, self.num_node))
for hop in valid_hop:
adjacency[self.hop_dis == hop] = 1
normalize_adjacency = normalize_digraph(adjacency)
if strategy == 'uniform':
A = np.zeros((1, self.num_node, self.num_node))
A[0] = normalize_adjacency
self.A_j = A
elif strategy == 'distance':
A = np.zeros((len(valid_hop), self.num_node, self.num_node))
for i, hop in enumerate(valid_hop):
A[i][self.hop_dis == hop] = normalize_adjacency[self.hop_dis == hop]
self.A_j = A
elif strategy == 'spatial':
A = []
for hop in valid_hop:
a_root = np.zeros((self.num_node, self.num_node))
a_close = np.zeros((self.num_node, self.num_node))
a_further = np.zeros((self.num_node, self.num_node))
for i in range(self.num_node):
for j in range(self.num_node):
if self.hop_dis[j, i] == hop:
if self.hop_dis[j, self.center] == self.hop_dis[i, self.center]:
a_root[j, i] = normalize_adjacency[j, i]
elif self.hop_dis[j, self.center] > self.hop_dis[i, self.center]:
a_close[j, i] = normalize_adjacency[j, i]
else:
a_further[j, i] = normalize_adjacency[j, i]
if hop == 0:
A.append(a_root)
else:
A.append(a_root + a_close)
A.append(a_further)
A = np.stack(A)
self.A_j = A
class Graph_P():
def __init__(self, layout='cmu', strategy='uniform', max_hop=1, dilation=1):
self.max_hop = max_hop
self.dilation = dilation
self.get_edge(layout)
self.hop_dis = get_hop_distance(self.num_node, self.edge, max_hop=max_hop)
self.get_adjacency(strategy)
def __str__(self):
return self.A_p
def get_edge(self, layout):
if layout == 'cmu':
self.num_node = 10
self_link = [(i, i) for i in range(self.num_node)]
neighbor_link_ = [(1,2),(3,4),(1,5),(3,5),(5,6),(5,7),(7,8),(5,9),(9,10)]
neighbor_link = [(i-1,j-1) for (i,j) in neighbor_link_]
self.edge = self_link + neighbor_link
self.center = 5-1
def get_adjacency(self, strategy):
valid_hop = range(0, self.max_hop + 1, self.dilation)
adjacency = np.zeros((self.num_node, self.num_node))
for hop in valid_hop:
adjacency[self.hop_dis == hop] = 1
normalize_adjacency = normalize_digraph(adjacency)
if strategy == 'uniform':
A = np.zeros((1, self.num_node, self.num_node))
A[0] = normalize_adjacency
self.A_p = A
elif strategy == 'distance':
A = np.zeros((len(valid_hop), self.num_node, self.num_node))
for i, hop in enumerate(valid_hop):
A[i][self.hop_dis == hop] = normalize_adjacency[self.hop_dis == hop]
self.A_p = A
elif strategy == 'spatial':
A = []
for hop in valid_hop:
a_root = np.zeros((self.num_node, self.num_node))
a_close = np.zeros((self.num_node, self.num_node))
a_further = np.zeros((self.num_node, self.num_node))
for i in range(self.num_node):
for j in range(self.num_node):
if self.hop_dis[j, i] == hop:
if self.hop_dis[j, self.center] == self.hop_dis[i, self.center]:
a_root[j, i] = normalize_adjacency[j, i]
elif self.hop_dis[j, self.center] > self.hop_dis[i, self.center]:
a_close[j, i] = normalize_adjacency[j, i]
else:
a_further[j, i] = normalize_adjacency[j, i]
if hop == 0:
A.append(a_root)
else:
A.append(a_root + a_close)
A.append(a_further)
A = np.stack(A)
self.A_p = A
class Graph_B():
def __init__(self, layout='cmu', strategy='uniform', max_hop=1, dilation=1):
self.max_hop = max_hop
self.dilation = dilation
self.get_edge(layout)
self.hop_dis = get_hop_distance(self.num_node, self.edge, max_hop=max_hop)
self.get_adjacency(strategy)
def __str__(self):
return self.A_b
def get_edge(self, layout):
if layout == 'cmu':
self.num_node = 5
self_link = [(i, i) for i in range(self.num_node)]
neighbor_link_ = [(1,3),(2,3),(3,4),(3,5)]
neighbor_link = [(i-1,j-1) for (i,j) in neighbor_link_]
self.edge = self_link + neighbor_link
self.center = 3-1
def get_adjacency(self, strategy):
valid_hop = range(0, self.max_hop + 1, self.dilation)
adjacency = np.zeros((self.num_node, self.num_node))
for hop in valid_hop:
adjacency[self.hop_dis == hop] = 1
normalize_adjacency = normalize_digraph(adjacency)
if strategy == 'uniform':
A = np.zeros((1, self.num_node, self.num_node))
A[0] = normalize_adjacency
self.A_b = A
elif strategy == 'distance':
A = np.zeros((len(valid_hop), self.num_node, self.num_node))
for i, hop in enumerate(valid_hop):
A[i][self.hop_dis == hop] = normalize_adjacency[self.hop_dis == hop]
self.A_b = A
elif strategy == 'spatial':
A = []
for hop in valid_hop:
a_root = np.zeros((self.num_node, self.num_node))
a_close = np.zeros((self.num_node, self.num_node))
a_further = np.zeros((self.num_node, self.num_node))
for i in range(self.num_node):
for j in range(self.num_node):
if self.hop_dis[j, i] == hop:
if self.hop_dis[j, self.center] == self.hop_dis[i, self.center]:
a_root[j, i] = normalize_adjacency[j, i]
elif self.hop_dis[j, self.center] > self.hop_dis[i, self.center]:
a_close[j, i] = normalize_adjacency[j, i]
else:
a_further[j, i] = normalize_adjacency[j, i]
if hop == 0:
A.append(a_root)
else:
A.append(a_root + a_close)
A.append(a_further)
A = np.stack(A)
self.A_b = A
def get_hop_distance(num_node, edge, max_hop=1):
A = np.zeros((num_node, num_node))
for i, j in edge:
A[j, i] = 1
A[i, j] = 1
hop_dis = np.zeros((num_node, num_node)) + np.inf
transfer_mat = [np.linalg.matrix_power(A, d) for d in range(max_hop + 1)]
arrive_mat = (np.stack(transfer_mat) > 0)
for d in range(max_hop, -1, -1):
hop_dis[arrive_mat[d]] = d
return hop_dis
def normalize_digraph(A):
Dl = np.sum(A, 0)
num_node = A.shape[0]
Dn = np.zeros((num_node, num_node))
for i in range(num_node):
if Dl[i] > 0:
Dn[i, i] = Dl[i]**(-1)
AD = np.dot(A, Dn)
return AD
def normalize_undigraph(A):
Dl = np.sum(A, 0)
num_node = A.shape[0]
Dn = np.zeros((num_node, num_node))
for i in range(num_node):
if Dl[i] > 0:
Dn[i, i] = Dl[i]**(-0.5)
DAD = np.dot(np.dot(Dn, A), Dn)
return DAD
| 40.454148
| 93
| 0.503886
| 1,313
| 9,264
| 3.347296
| 0.072353
| 0.101934
| 0.127645
| 0.071672
| 0.912173
| 0.909898
| 0.903754
| 0.882821
| 0.872127
| 0.863936
| 0
| 0.042958
| 0.35924
| 9,264
| 228
| 94
| 40.631579
| 0.697439
| 0.028713
| 0
| 0.805128
| 0
| 0
| 0.011676
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.076923
| false
| 0
| 0.005128
| 0.015385
| 0.128205
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
cf3538009a237dab4300e27c779760872164ce6c
| 286
|
py
|
Python
|
Florence/VariationalPrinciple/__init__.py
|
jdlaubrie/florence
|
830dca4a34be00d6e53cbec3007c10d438b27f57
|
[
"MIT"
] | 65
|
2017-08-04T10:21:13.000Z
|
2022-02-21T21:45:09.000Z
|
Florence/VariationalPrinciple/__init__.py
|
jdlaubrie/florence
|
830dca4a34be00d6e53cbec3007c10d438b27f57
|
[
"MIT"
] | 6
|
2018-06-03T02:29:20.000Z
|
2022-01-18T02:30:22.000Z
|
Florence/VariationalPrinciple/__init__.py
|
jdlaubrie/florence
|
830dca4a34be00d6e53cbec3007c10d438b27f57
|
[
"MIT"
] | 10
|
2018-05-30T09:44:10.000Z
|
2021-05-18T08:06:51.000Z
|
from .VariationalPrinciple import *
from .DisplacementFormulation import *
from .DisplacementPotentialFormulation import *
from .LaplacianFormulation import *
from .ExplicitPenaltyContactFormulation import *
from .CoupleStressFormulation import *
from .FlexoelectricFormulation import *
| 40.857143
| 48
| 0.856643
| 21
| 286
| 11.666667
| 0.428571
| 0.244898
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.094406
| 286
| 7
| 49
| 40.857143
| 0.945946
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 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
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
cf69d0e6d9fbdd6655d5199aa084545f7ed81e82
| 189
|
py
|
Python
|
flanaapis/geolocation/__init__.py
|
AlberLC/flanaapis
|
a1124d0fc8c77b7baa459b63a789fc4b22799ee2
|
[
"MIT"
] | 1
|
2022-01-26T09:20:47.000Z
|
2022-01-26T09:20:47.000Z
|
flanaapis/geolocation/__init__.py
|
AlberLC/flanaapis
|
a1124d0fc8c77b7baa459b63a789fc4b22799ee2
|
[
"MIT"
] | null | null | null |
flanaapis/geolocation/__init__.py
|
AlberLC/flanaapis
|
a1124d0fc8c77b7baa459b63a789fc4b22799ee2
|
[
"MIT"
] | null | null | null |
from flanaapis.geolocation.functions import *
from flanaapis.geolocation.google_maps import *
from flanaapis.geolocation.models import *
from flanaapis.geolocation.open_street_map import *
| 37.8
| 51
| 0.851852
| 23
| 189
| 6.869565
| 0.478261
| 0.329114
| 0.607595
| 0.56962
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.084656
| 189
| 4
| 52
| 47.25
| 0.913295
| 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
| 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
| 1
| 0
|
0
| 8
|
d8746d2a9032ed89a1792300b14306eb7e0aa07e
| 3,516
|
py
|
Python
|
tests/help/test_timing.py
|
pfeairheller/hio
|
44669adb62c81357491f9f6157312bc1313b56cf
|
[
"Apache-2.0"
] | 1
|
2021-04-07T19:10:28.000Z
|
2021-04-07T19:10:28.000Z
|
tests/help/test_timing.py
|
pfeairheller/hio
|
44669adb62c81357491f9f6157312bc1313b56cf
|
[
"Apache-2.0"
] | 4
|
2021-03-30T20:50:19.000Z
|
2022-01-06T17:16:18.000Z
|
tests/help/test_timing.py
|
pfeairheller/hio
|
44669adb62c81357491f9f6157312bc1313b56cf
|
[
"Apache-2.0"
] | 3
|
2021-04-08T19:35:36.000Z
|
2021-06-03T13:39:05.000Z
|
# -*- encoding: utf-8 -*-
"""
tests.help.test_timing module
"""
import time
import pytest
from hio.help.timing import TimerError, RetroTimerError
from hio.help.timing import Timer, MonoTimer
def test_timer():
"""
Test Timer class
"""
timer = Timer()
assert timer.duration == 0.0
assert timer.elapsed > 0.0
assert timer.remaining < 0.0
assert timer.expired == True
timer.restart(duration=0.125)
assert timer.duration == 0.125
assert timer.elapsed > 0.0
assert timer.remaining > 0.0
assert timer.expired == False
time.sleep(0.125)
assert timer.expired == True
timer.start(duration = 0.125)
assert timer.duration == 0.125
assert timer.elapsed < 0.125
assert timer.remaining > 0.0
assert timer.expired == False
time.sleep(0.125)
assert timer.expired == True
timer = Timer(duration=0.125)
assert timer.duration == 0.125
assert timer.elapsed > 0.0
assert timer.remaining > 0.0
assert timer.expired == False
time.sleep(0.125)
assert timer.expired == True
timer = Timer(duration=0.125, start=time.time() + 0.05)
assert timer.duration == 0.125
assert timer.elapsed < 0.0
assert timer.remaining > 0.125
assert timer.expired == False
time.sleep(0.175)
assert timer.expired == True
timer = Timer(duration=0.125, start=time.time() - 0.05)
assert timer.duration == 0.125
assert timer.elapsed > 0.0
assert timer.remaining < 0.075
assert timer.expired == False
time.sleep(0.075)
assert timer.expired == True
"""End Test """
def test_monotimer():
"""
Test MonoTimer class
"""
timer = MonoTimer()
assert timer.duration == 0.0
assert timer.elapsed > 0.0
assert timer.remaining < 0.0
assert timer.expired == True
timer.restart(duration=0.125)
assert timer.duration == 0.125
assert timer.elapsed > 0.0
assert timer.remaining > 0.0
assert timer.expired == False
time.sleep(0.125)
assert timer.expired == True
timer.start(duration = 0.125)
assert timer.duration == 0.125
assert timer.elapsed < 0.125
assert timer.remaining > 0.0
assert timer.expired == False
time.sleep(0.125)
assert timer.expired == True
timer = MonoTimer(duration=0.125)
assert timer.duration == 0.125
assert timer.elapsed > 0.0
assert timer.remaining > 0.0
assert timer.expired == False
time.sleep(0.125)
assert timer.expired == True
timer = MonoTimer(duration=0.125, start=time.time() + 0.05) #
assert timer.duration == 0.125
assert timer.elapsed <= 0.0
assert timer.remaining < 0.125
assert timer.expired == False
time.sleep(0.175)
assert timer.expired == True
timer = MonoTimer(duration=0.125, start=time.time() - 0.05)
assert timer.duration == 0.125
assert timer.elapsed > 0.0
assert timer.remaining < 0.075
assert timer.expired == False
time.sleep(0.075)
assert timer.expired == True
timer = MonoTimer(duration=0.125, retro=False)
timer._last = timer._start + 0.05 # simulate retrograded
with pytest.raises(RetroTimerError):
assert timer.elapsed > 0.0
timer = MonoTimer(duration=0.125)
timer._last = timer._start + 0.05 # simulate retrograded
assert timer.elapsed > 0.0
assert timer.remaining > 0.0
assert timer.expired == False
time.sleep(0.125)
assert timer.expired == True
"""End Test """
if __name__ == "__main__":
test_monotimer()
| 26.43609
| 66
| 0.650739
| 488
| 3,516
| 4.655738
| 0.090164
| 0.305018
| 0.118838
| 0.178257
| 0.891725
| 0.851232
| 0.84507
| 0.84507
| 0.808979
| 0.797535
| 0
| 0.08164
| 0.230091
| 3,516
| 132
| 67
| 26.636364
| 0.757665
| 0.038111
| 0
| 0.787879
| 0
| 0
| 0.002417
| 0
| 0
| 0
| 0
| 0
| 0.636364
| 1
| 0.020202
| false
| 0
| 0.040404
| 0
| 0.060606
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
d8a92b6f97ade3f8d3cdbaa3d3f9c9fc3e7a2d32
| 23,831
|
py
|
Python
|
UI/queries2.py
|
gustavo-moura/ABCSystem
|
bdd98d1b18033af81437cc85502659fc4484937d
|
[
"MIT"
] | 1
|
2018-06-13T15:20:48.000Z
|
2018-06-13T15:20:48.000Z
|
UI/queries2.py
|
gustavo-moura/ABCSystem
|
bdd98d1b18033af81437cc85502659fc4484937d
|
[
"MIT"
] | null | null | null |
UI/queries2.py
|
gustavo-moura/ABCSystem
|
bdd98d1b18033af81437cc85502659fc4484937d
|
[
"MIT"
] | null | null | null |
import os
os.chdir("C:\\oraclexe\\instantclient_12_2")
import cx_Oracle
class connection():
def hello():
print("Hello world")
def connect():
# opening connection
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
def checkLogin(user, pwd):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
try:
#query = "SELECT E.login, P.senha, E.funcao, E.documento FROM Pessoa P JOIN Empregado E ON P.id_pessoa=E.id_pessoa where E.login='"+user+"' AND P.senha='"+pwd+"'"
query = "SELECT E.login, P.senha, E.documento, case funcao WHEN 'Production Supervisor - WC20' THEN 1 WHEN 'Shipping and Receiving Supervisor' THEN 1 WHEN 'Stocker' THEN 2 ELSE 3 end FROM Pessoa P JOIN Empregado E ON P.id_pessoa=E.id_pessoa where E.login='"+user+"' AND P.senha='"+user+"'"
curs = orcl.cursor()
curs.execute(query)
row = curs.fetchone()
documento = row[2]
tipo = row[3]
insert = "INSERT INTO LogAcesso VALUES ("+documento+", to_char(sysdate,'DD/MM/YYYY hh24:mm:ss'))"
curs = orcl.cursor()
curs.execute(insert)
commit = "COMMIT"
curs = orcl.cursor()
curs.execute(commit)
orcl.close()
#print("Logado com sucesso!")
return tipo
except:
#print("Login nao efetuado...")
orcl.close()
return -1
# top 15 produtos
def top15products():
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
query = "SELECT NOME, PRECO, PESO, CATEGORIA, QUANTIDADE FROM (SELECT P.NOME, P.PRECO, P.PESO, C.NOME CATEGORIA, SUM(QUANTIDADE) QUANTIDADE FROM VENDA V JOIN ITEMVENDA I ON V.ID_VENDA=I.ID_VENDA JOIN PRODUTO P ON P.ID_PRODUTO=I.ID_PRODUTO JOIN SUBCATEGORIA S ON P.ID_SUBCATEGORIA=S.ID_SUBCATEGORIA JOIN CATEGORIA C ON C.ID_CATEGORIA=S.ID_CATEGORIA WHERE V.DATA_VENDA<=sysdate AND V.DATA_VENDA>=add_months(sysdate, -6) GROUP BY P.NOME, P.PRECO, P.PESO, C.NOME ORDER BY 5 DESC)"
try:
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
#print(rows)
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
print("Deu erro nos top 15")
return None
def rel_1(nome):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
if(sorted(nome) == sorted("Pesquisar")):
nome = ""
try:
query = "SELECT P.nome, P.email, V.data_venda, C.cartao_tipo, C.cartao_numero, C.cartao_validade_mes, C.cartao_validade_ano FROM Cliente C JOIN Pessoa P ON P.id_pessoa=C.id_pessoa JOIN Venda V ON C.id_cliente=V.id_cliente WHERE TO_DATE(C.CARTAO_VALIDADE_MES||'/'||C.CARTAO_VALIDADE_ANO, 'MM/YYYY')<SYSDATE AND P.NOME LIKE '%"+nome+"%'"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
commit = "COMMIT"
curs = orcl.cursor()
curs.execute(commit)
orcl.close()
return rows
except:
print("Erro na query...")
orcl.close()
return None
def rel_2(nome):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
if(sorted(nome) == sorted("Pesquisar")):
nome = ""
try:
query = "SELECT P.nome, D.nome, H.turno, H.data_entrada, empregado_ativo(H.data_saida) FROM Pessoa P JOIN HistoricoDepartamento H ON P.id_pessoa=H.id_pessoa JOIN Departamento D ON D.id_departamento=H.id_departamento WHERE P.nome LIKE '%"+nome+"%'"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except:
print("Erro na query...")
orcl.close()
return None
def rel_3_1(ano):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
if(sorted(ano) == sorted("Pesquisar")):
ano = "2010"
try:
query = "SELECT SUM(valor_frete), EXTRACT(YEAR FROM data_venda) FROM VENDA WHERE EXTRACT(YEAR FROM data_venda)="+ano+" GROUP BY EXTRACT(YEAR FROM data_venda)"
curs = orcl.cursor()
curs.execute(query)
rows1 = curs.fetchall()
orcl.close()
return rows1
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def rel_3_2(ano):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
if(sorted(ano) == sorted("Pesquisar")):
ano = "2010"
try:
query = "SELECT SUM(valor_frete) FROM VENDA WHERE subtotal>2000 AND EXTRACT(YEAR FROM data_venda)="+ano
curs = orcl.cursor()
curs.execute(query)
rows2 = curs.fetchall()
orcl.close()
return rows2
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def rel_3_3(ano):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
if(sorted(ano) == sorted("Pesquisar")):
ano = "2010"
try:
query = "SELECT SUM(valor_frete) FROM VENDA WHERE subtotal<=2000 AND EXTRACT(YEAR FROM data_venda)="+ano
curs = orcl.cursor()
curs.execute(query)
rows3 = curs.fetchall()
orcl.close()
return rows3
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def rel_4(ano):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
if(sorted(ano) == sorted("Pesquisar")):
ano = "2010"
try:
query = "SELECT EXTRACT(MONTH FROM data_venda), SUM(subtotal) FROM Venda WHERE EXTRACT(YEAR FROM data_venda)="+ano+"GROUP BY EXTRACT(MONTH FROM data_venda)ORDER BY 1"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def rel_5(data):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
query = "SELECT NOME, PRECO, PESO, CATEGORIA, QUANTIDADE FROM (SELECT P.NOME, P.PRECO, P.PESO, C.NOME CATEGORIA, SUM(QUANTIDADE) QUANTIDADE FROM VENDA V JOIN ITEMVENDA I ON V.ID_VENDA=I.ID_VENDA JOIN PRODUTO P ON P.ID_PRODUTO=I.ID_PRODUTO JOIN SUBCATEGORIA S ON P.ID_SUBCATEGORIA=S.ID_SUBCATEGORIA JOIN CATEGORIA C ON C.ID_CATEGORIA=S.ID_CATEGORIA WHERE V.DATA_VENDA<=SYSDATE AND V.DATA_VENDA>=ADD_MONTHS(SYSDATE, -6) GROUP BY P.NOME, P.PRECO, P.PESO, C.NOME) WHERE ROWNUM<=15 ORDER BY QUANTIDADE DESC"
#query = "SELECT NOME, PRECO, PESO, CATEGORIA, QUANTIDADE FROM (SELECT P.NOME, P.PRECO, P.PESO, C.NOME CATEGORIA, SUM(QUANTIDADE), QUANTIDADE FROM VENDA V JOIN ITEMVENDA I ON V.ID_VENDA=I.ID_VENDA JOIN PRODUTO P ON P.ID_PRODUTO=I.ID_PRODUTO JOIN SUBCATEGORIA S ON P.ID_SUBCATEGORIA=S.ID_SUBCATEGORIA JOIN CATEGORIA C ON C.ID_CATEGORIA=S.ID_CATEGORIA WHERE V.DATA_VENDA=<to_date('"+data+"', 'DD/MM/YYYY') AND V.DATA_VENDA>=add_months(to_date('"+data+"', 'DD/MM/YYYY'), -6) GROUP BY P.NOME, P.PRECO, P.PESO, C.NOME ORDER BY 5 DESC) WHERE ROWNUM<=15"
try:
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
print("Deu erro nos top 15")
return None
def rel_6(qtd):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
if(sorted(qtd) == sorted("Pesquisar")):
qtd = "1"
try:
query = "SELECT J.CATEGORIA CATEGORIA_1, J.SUBCATEGORIA SUBCATEGORIA_1, J.PRODUTO PRODUTO_1, SUM(J.QTD) QUANTIDADE_1, K.CATEGORIA CATEGORIA_2, K.SUBCATEGORIA SUBCATEGORIA_2, K.PRODUTO PRODUTO_2, SUM(K.QTD) QUANTIDADE_2, COUNT(K.VENDA) QTD_VENDA FROM (SELECT P.NOME PRODUTO, C.NOME CATEGORIA, S.NOME SUBCATEGORIA, I.ID_VENDA VENDA, I.QUANTIDADE_ESTOQUE QTD FROM PRODUTO P JOIN SUBCATEGORIA S ON S.ID_SUBCATEGORIA=P.ID_SUBCATEGORIA JOIN CATEGORIA C ON C.ID_CATEGORIA=S.ID_CATEGORIA JOIN ITEMVENDA I ON I.ID_PRODUTO=P.ID_PRODUTO) J JOIN (SELECT P.NOME PRODUTO, C.NOME CATEGORIA, S.NOME SUBCATEGORIA, I.ID_VENDA VENDA, I.QUANTIDADE_ESTOQUE QTD FROM PRODUTO P JOIN SUBCATEGORIA S ON S.ID_SUBCATEGORIA=P.ID_SUBCATEGORIA JOIN CATEGORIA C ON C.ID_CATEGORIA=S.ID_CATEGORIA JOIN ITEMVENDA I ON I.ID_PRODUTO=P.ID_PRODUTO) K ON J.VENDA=K.VENDA WHERE J.PRODUTO||J.CATEGORIA||J.SUBCATEGORIA!=K.PRODUTO||K.CATEGORIA||K.SUBCATEGORIA GROUP BY J.PRODUTO, J.CATEGORIA, J.SUBCATEGORIA, K.PRODUTO, K.CATEGORIA, K.SUBCATEGORIA ORDER BY 7 DESC"
#query = "SELECT J.CATEGORIA CATEGORIA_1, J.SUBCATEGORIA SUBCATEGORIA_1, J.PRODUTO PRODUTO_1, SUM(J.QTD) QUANTIDADE_1, K.CATEGORIA CATEGORIA_2, K.SUBCATEGORIA SUBCATEGORIA_2, K.PRODUTO PRODUTO_2, SUM(K.QTD) QUANTIDADE_2, COUNT(K.VENDA) QTD_VENDA FROM (SELECT P.NOME PRODUTO, C.NOME CATEGORIA, S.NOME SUBCATEGORIA, I.ID_VENDA VENDA, I.QUANTIDADE_ESTOQUE QTD FROM PRODUTO P JOIN SUBCATEGORIA S ON S.ID_SUBCATEGORIA=P.ID_SUBCATEGORIA JOIN CATEGORIA C ON C.ID_CATEGORIA=S.ID_CATEGORIA JOIN ITEMVENDA I ON I.ID_PRODUTO=P.ID_PRODUTO) J JOIN (SELECT P.NOME PRODUTO, C.NOME CATEGORIA, S.NOME SUBCATEGORIA, I.ID_VENDA VENDA, I.QUANTIDADE_ESTOQUE QTD FROM PRODUTO P JOIN SUBCATEGORIA S ON S.ID_SUBCATEGORIA=P.ID_SUBCATEGORIA JOIN CATEGORIA C ON C.ID_CATEGORIA=S.ID_CATEGORIA JOIN ITEMVENDA I ON I.ID_PRODUTO=P.ID_PRODUTO) K ON J.VENDA=K.VENDA WHERE J.PRODUTO||J.CATEGORIA||J.SUBCATEGORIA!=K.PRODUTO||K.CATEGORIA||K.SUBCATEGORIA GROUP BY J.PRODUTO, J.CATEGORIA, J.SUBCATEGORIA, K.PRODUTO, K.CATEGORIA, K.SUBCATEGORIA AND COUNT(K.QUANTIDADE)="+qtd+" ORDER BY 7 DESC"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def rel_7(ano):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
if(sorted(ano) == sorted("Pesquisar")):
ano = "2010"
try:
#query = "SELECT E.PAIS, SUM(SUBTOTAL) FROM VENDA V JOIN CLIENTE C ON C.ID_CLIENTE=V.ID_CLIENTE JOIN PESSOA P ON P.ID_PESSOA=C.ID_PESSOA JOIN ENDERECO E ON E.ID_ENDERECO=P.ID_ENDERECO WHERE PAIS='US' GROUP BY E.PAIS; SELECT SUM(SUBTOTAL) FROM VENDA V JOIN CLIENTE C ON C.ID_CLIENTE=V.ID_CLIENTE JOIN PESSOA P ON P.ID_PESSOA=C.ID_PESSOA JOIN ENDERECO E ON E.ID_ENDERECO=P.ID_ENDERECO WHERE PAIS='US' AND EXTRACT(YEAR FROM DATA_VENDA)="+ano+" GROUP BY E.PAIS; SELECT ESTADO, VALOR FROM (SELECT E.ESTADO ESTADO, SUM(SUBTOTAL) VALOR FROM VENDA V JOIN CLIENTE C ON C.ID_CLIENTE=V.ID_CLIENTE JOIN PESSOA P ON P.ID_PESSOA=C.ID_PESSOA JOIN ENDERECO E ON E.ID_ENDERECO=P.ID_ENDERECO WHERE PAIS='US' GROUP BY E.ESTADO ORDER BY 2 DESC) WHERE ROWNUM=1;
query = "SELECT VALOR FROM (SELECT E.ESTADO ESTADO, SUM(SUBTOTAL) VALOR FROM VENDA V JOIN CLIENTE C ON C.ID_CLIENTE=V.ID_CLIENTE JOIN PESSOA P ON P.ID_PESSOA=C.ID_PESSOA JOIN ENDERECO E ON E.ID_ENDERECO=P.ID_ENDERECO WHERE PAIS='US' AND EXTRACT(YEAR FROM V.DATA_VENDA)="+ano+" GROUP BY E.ESTADO ORDER BY 2 DESC) WHERE ROWNUM=1"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def atualiza_1(dia, mes, ano):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
data = []
try:
query = "SELECT SUM(SUBTOTAL) AS ANO FROM VENDA WHERE EXTRACT(DAY FROM DATA_VENDA)="+dia
curs = orcl.cursor()
curs.execute(query)
row = curs.fetchone()
if (row != None):
data.append(row[0])
else:
data.append("--")
query = "SELECT SUM(SUBTOTAL) AS ANO FROM VENDA WHERE EXTRACT(MONTH FROM DATA_VENDA)="+mes
curs = orcl.cursor()
curs.execute(query)
row = curs.fetchone()
if (row != None):
data.append(row[0])
else:
data.append("--")
query = "SELECT SUM(SUBTOTAL) AS ANO FROM VENDA WHERE EXTRACT(YEAR FROM DATA_VENDA)="+ano
curs = orcl.cursor()
curs.execute(query)
row = curs.fetchone()
if (row != None):
data.append(row[0])
else:
data.append("----")
orcl.close()
return data
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def atualiza_2(mes, ano):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
try:
query = "SELECT NOME, ID, VALOR FROM (SELECT P.NOME AS NOME, V.ID_VENDEDOR AS ID, SUM(SUBTOTAL) AS VALOR FROM VENDA V JOIN PESSOA P ON P.ID_PESSOA=V.ID_VENDEDOR WHERE EXTRACT(YEAR FROM V.DATA_VENDA)="+ano+" GROUP BY P.NOME, V.ID_VENDEDOR ORDER BY 3 DESC) WHERE ROWNUM<=3"
curs = orcl.cursor()
curs.execute(query)
result = []
rows = curs.fetchone()
if (rows != None):
result.append(rows[0])
else:
result.append("- - -")
rows = curs.fetchone()
if (rows != None):
result.append(rows[0])
else:
result.append("- - -")
rows = curs.fetchone()
if (rows != None):
result.append(rows[0])
else:
result.append("- - -")
query = "SELECT NOME, ID, VALOR FROM (SELECT P.NOME AS NOME, V.ID_VENDEDOR AS ID, SUM(SUBTOTAL) AS VALOR FROM VENDA V JOIN PESSOA P ON P.ID_PESSOA=V.ID_VENDEDOR WHERE EXTRACT(YEAR FROM V.DATA_VENDA)="+ano+" AND EXTRACT(MONTH FROM V.DATA_VENDA)="+mes+" GROUP BY P.NOME, V.ID_VENDEDOR ORDER BY 3 DESC) WHERE ROWNUM<=3"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchone()
if (rows != None):
result.append(rows[0])
else:
result.append("- - -")
rows = curs.fetchone()
if (rows != None):
result.append(rows[0])
else:
result.append("- - -")
rows = curs.fetchone()
if (rows != None):
result.append(rows[0])
else:
result.append("- - -")
#print(result)
orcl.close()
return result
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def atualiza_3():
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
try:
query = "SELECT NOME, PRECO, PESO, CATEGORIA, QUANTIDADE FROM (SELECT P.NOME, P.PRECO, P.PESO, C.NOME CATEGORIA, SUM(QUANTIDADE) QUANTIDADE FROM VENDA V JOIN ITEMVENDA I ON V.ID_VENDA=I.ID_VENDA JOIN PRODUTO P ON P.ID_PRODUTO=I.ID_PRODUTO JOIN SUBCATEGORIA S ON P.ID_SUBCATEGORIA=S.ID_SUBCATEGORIA JOIN CATEGORIA C ON C.ID_CATEGORIA=S.ID_CATEGORIA WHERE V.DATA_VENDA<=sysdate AND V.DATA_VENDA>=add_months(sysdate, -6) GROUP BY P.NOME, P.PRECO, P.PESO, C.NOME ORDER BY 5 DESC)"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def atualiza_4(ano):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
try:
query = "SELECT CLIENTE, VALOR FROM (SELECT V.ID_CLIENTE AS CLIENTE, SUM(SUBTOTAL) AS VALOR FROM VENDA V JOIN CLIENTE C ON V.ID_CLIENTE=C.ID_CLIENTE WHERE EXTRACT(YEAR FROM DATA_VENDA)="+ano+" GROUP BY V.ID_CLIENTE ORDER BY 2 DESC) WHERE ROWNUM<=15"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def atualiza_5():
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
try:
query = "SELECT CLIENTE, VALOR FROM (SELECT V.ID_CLIENTE AS CLIENTE, SUM(SUBTOTAL) AS VALOR FROM VENDA V JOIN CLIENTE C ON V.ID_CLIENTE=C.ID_CLIENTE GROUP BY V.ID_CLIENTE ORDER BY 2 DESC) WHERE ROWNUM<=15"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def atualiza_6():
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
try:
query = "SELECT NOME, QUANTIDADE FROM PRODUTO WHERE QUANTIDADE<10 ORDER BY 2"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def atualiza_7(ano):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
try:
query = "SELECT EXTRACT(MONTH FROM DATA_VENDA) AS MES, SUM(SUBTOTAL) VALOR FROM VENDA WHERE EXTRACT(YEAR FROM DATA_VENDA)="+ano+" GROUP BY EXTRACT(MONTH FROM DATA_VENDA) ORDER BY 1"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def atualiza_8(ano1, ano2):
ORACLE_CONNECT = "a9762942/a9762942@(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=grad.icmc.usp.br)(PORT=15215)))(CONNECT_DATA=(SID=orcl)(SRVR=DEDICATED)))"
orcl = cx_Oracle.connect(ORACLE_CONNECT)
#print("Connected to Oracle: " + orcl.version)
try:
query = "SELECT EXTRACT(YEAR FROM DATA_VENDA) MES, SUM(SUBTOTAL) VALOR FROM VENDA WHERE EXTRACT(YEAR FROM DATA_VENDA)>="+ano1+" AND EXTRACT(YEAR FROM DATA_VENDA)<="+ano2+" GROUP BY EXTRACT(YEAR FROM DATA_VENDA) ORDER BY 1"
curs = orcl.cursor()
curs.execute(query)
rows = curs.fetchall()
orcl.close()
return rows
except cx_Oracle.DatabaseError as e:
print(e)
orcl.close()
return None
def disconnect():
# closing connection
orcl.close()
print("Disconnected to Oracle")
| 48.046371
| 1,066
| 0.620117
| 3,187
| 23,831
| 4.527142
| 0.060559
| 0.054062
| 0.036388
| 0.031189
| 0.918838
| 0.906016
| 0.897976
| 0.891392
| 0.882104
| 0.875866
| 0
| 0.029464
| 0.260837
| 23,831
| 496
| 1,067
| 48.046371
| 0.789611
| 0.148336
| 0
| 0.813889
| 0
| 0.094444
| 0.458969
| 0.225216
| 0
| 0
| 0
| 0
| 0
| 1
| 0.061111
| false
| 0
| 0.005556
| 0
| 0.175
| 0.061111
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
2b08972e87fd41e343da08531ee9b59f7b54b839
| 2,274
|
py
|
Python
|
katana-cli/cli/commands/cmd_resources.py
|
tgogos/katana-slice_manager
|
75e47751d1566ad9cea54cf715cfe36dae1debc4
|
[
"Apache-2.0"
] | 55
|
2019-07-24T15:52:11.000Z
|
2022-03-27T22:58:59.000Z
|
katana-cli/cli/commands/cmd_resources.py
|
tgogos/katana-slice_manager
|
75e47751d1566ad9cea54cf715cfe36dae1debc4
|
[
"Apache-2.0"
] | 39
|
2019-12-16T13:53:08.000Z
|
2022-01-29T15:58:20.000Z
|
katana-cli/cli/commands/cmd_resources.py
|
tgogos/katana-slice_manager
|
75e47751d1566ad9cea54cf715cfe36dae1debc4
|
[
"Apache-2.0"
] | 20
|
2019-07-25T09:17:33.000Z
|
2022-03-28T03:34:38.000Z
|
import requests
import json
import click
@click.group()
def cli():
"""Query Resources"""
pass
@click.command()
def ls():
"""
List all resources
"""
url = "http://localhost:8000/api/resources"
r = None
try:
r = requests.get(url, timeout=30)
r.raise_for_status()
json_data = json.loads(r.content)
click.echo(json.dumps(json_data, indent=2))
except requests.exceptions.HTTPError as errh:
print("Http Error:", errh)
click.echo(r.content)
except requests.exceptions.ConnectionError as errc:
print("Error Connecting:", errc)
except requests.exceptions.Timeout as errt:
print("Timeout Error:", errt)
except requests.exceptions.RequestException as err:
print("Error:", err)
@click.command()
@click.argument("location")
def location(location):
"""
List all resources in the specific location
"""
url = "http://localhost:8000/api/resources/" + location
r = None
try:
r = requests.get(url, timeout=30)
r.raise_for_status()
json_data = json.loads(r.content)
click.echo(json.dumps(json_data, indent=2))
except requests.exceptions.HTTPError as errh:
print("Http Error:", errh)
click.echo(r.content)
except requests.exceptions.ConnectionError as errc:
print("Error Connecting:", errc)
except requests.exceptions.Timeout as errt:
print("Timeout Error:", errt)
except requests.exceptions.RequestException as err:
print("Error:", err)
@click.command()
def updatedb():
"""
Update the resource database
"""
url = "http://localhost:8000/api/resources/update"
r = None
try:
r = requests.get(url, timeout=30)
r.raise_for_status()
click.echo(r.content)
except requests.exceptions.HTTPError as errh:
print("Http Error:", errh)
click.echo(r.content)
except requests.exceptions.ConnectionError as errc:
print("Error Connecting:", errc)
except requests.exceptions.Timeout as errt:
print("Timeout Error:", errt)
except requests.exceptions.RequestException as err:
print("Error:", err)
cli.add_command(updatedb)
cli.add_command(ls)
cli.add_command(location)
| 27.071429
| 59
| 0.646438
| 275
| 2,274
| 5.298182
| 0.210909
| 0.115305
| 0.197666
| 0.046671
| 0.803706
| 0.803706
| 0.737817
| 0.72615
| 0.72615
| 0.72615
| 0
| 0.011429
| 0.230431
| 2,274
| 83
| 60
| 27.39759
| 0.821143
| 0.047054
| 0
| 0.746032
| 0
| 0
| 0.125236
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.063492
| false
| 0.015873
| 0.047619
| 0
| 0.111111
| 0.190476
| 0
| 0
| 0
| null | 0
| 1
| 0
| 1
| 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
| 8
|
99a68869a93b9816cce769b8e77521f0faceef56
| 3,149
|
py
|
Python
|
scripts/constants/models_config.py
|
daniele21/DL_soccer_prediction_v2
|
97bafe911fd8883d6679cf55fd0fff34db67ef06
|
[
"MIT"
] | null | null | null |
scripts/constants/models_config.py
|
daniele21/DL_soccer_prediction_v2
|
97bafe911fd8883d6679cf55fd0fff34db67ef06
|
[
"MIT"
] | null | null | null |
scripts/constants/models_config.py
|
daniele21/DL_soccer_prediction_v2
|
97bafe911fd8883d6679cf55fd0fff34db67ef06
|
[
"MIT"
] | null | null | null |
from scripts.constants.configs import *
from scripts.constants.league import *
from scripts.constants.paths import *
SERIE_A_PARAMS = {
"league": {
"league_name": SERIE_A,
"n_prev_match": 10,
"league_dir": DATA_DIR,
"train": "True"
},
"data": {
"normalize": "True",
"window_size": 50,
"dataset": BASE_DATASET,
"split_size": 0.986, # TO BE UPDATED (~50)
"test_size": 100,
"batch_size": 10,
"version": 2,
"league_dir": "resources/leagues_data/",
"train": "True"
},
"model": {
"dataset": BASE_DATASET,
"version": 2,
"out_lstm": 100,
"n_lstm_layer": 2,
"bidirectional": "True",
"kernel": 10,
"padding": 1,
"conv_layers": 1,
"optimizer": ADAM_OPTIMIZER,
"lr": 0.00001,
"loss": BCE_LOSS,
"seed": 2020,
"device": CUDA_DEVICE,
"verbose": "True",
"plot": "False",
"static_dir": STATIC_DIR
}
}
PREMIER_PARAMS = {
"league": {
"league_name": PREMIER,
"n_prev_match": 10,
"league_dir": DATA_DIR,
"train": "True"
},
"data": {
"normalize": "True",
"window_size": 50,
"dataset": BASE_DATASET,
"split_size": 0.986, # TO BE UPDATED (~50)
"test_size": 100,
"batch_size": 10,
"version": 2,
"league_dir": DATA_DIR,
"train": "True"
},
"model": {
"dataset": BASE_DATASET,
"version": 2,
"out_lstm": 100,
"n_lstm_layer": 2,
"bidirectional": "True",
"kernel": 10,
"padding": 1,
"conv_layers": 1,
"optimizer": ADAM_OPTIMIZER,
"lr": 0.00001,
"loss": BCE_LOSS,
"seed": 2020,
"device": CUDA_DEVICE,
"verbose": "True",
"plot": "False",
"static_dir": STATIC_DIR
}
}
MODEL_PARAMS = {SERIE_A: SERIE_A_PARAMS}
| 37.939759
| 69
| 0.31375
| 207
| 3,149
| 4.521739
| 0.304348
| 0.025641
| 0.076923
| 0.051282
| 0.770299
| 0.770299
| 0.762821
| 0.762821
| 0.762821
| 0.762821
| 0
| 0.053558
| 0.584948
| 3,149
| 83
| 70
| 37.939759
| 0.662586
| 0.012385
| 0
| 0.782051
| 0
| 0
| 0.183076
| 0.0074
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.038462
| 0
| 0.038462
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 1
| 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
| 7
|
51070da0314109329c30570f1992d31a99ca856d
| 27,479
|
py
|
Python
|
auth/tests.py
|
arcturus5340/julia
|
6bb7b6e956edc9b16f773926978679dd6031e959
|
[
"MIT"
] | 13
|
2018-10-20T17:31:00.000Z
|
2022-03-06T23:02:48.000Z
|
auth/tests.py
|
arcturus5340/julia
|
6bb7b6e956edc9b16f773926978679dd6031e959
|
[
"MIT"
] | 4
|
2019-10-08T18:24:38.000Z
|
2021-06-10T20:06:26.000Z
|
auth/tests.py
|
arcturus5340/julia
|
6bb7b6e956edc9b16f773926978679dd6031e959
|
[
"MIT"
] | 6
|
2018-10-29T00:58:55.000Z
|
2020-03-25T14:02:18.000Z
|
from django.core.files.uploadedfile import SimpleUploadedFile
from django.contrib.auth.models import Group
from django.core.files import File
from django.core import mail
from django.contrib import auth
from django.conf import settings
from rest_framework.test import APIClient, APITestCase
from rest_framework import status
from auth.models import Activation
import os
class UserTestCase(APITestCase):
def setUp(self):
verified_users_group = Group.objects.create(name='Verified Users')
self.first_user = auth.get_user_model().objects.create(
username='TestUsername1',
email='TestEmail1',
)
self.first_user.set_password('TestPassword1')
self.first_user.text_password = 'TestPassword1'
self.first_user.groups.add(verified_users_group)
self.first_user.save()
self.second_user = auth.get_user_model().objects.create(
username='TestUsername2',
email='TestEmail2',
)
self.second_user.set_password('TestPassword2')
self.second_user.text_password = 'TestPassword2'
self.second_user.groups.add(verified_users_group)
self.second_user.save()
self.admin_user = auth.get_user_model().objects.create(
username='TestAdminUsername',
email='TestAdminEmail',
is_staff=True,
)
self.admin_user.set_password('TestAdminPassword')
self.admin_user.text_password = 'TestAdminPassword'
self.admin_user.groups.add(verified_users_group)
self.admin_user.save()
self.full_result_keys = ('id', 'username', 'email', 'date_joined', 'last_login')
self.basic_result_keys = ('id', 'username', 'date_joined', 'last_login')
@staticmethod
def authorize(user, username=None, password=None):
sign_in_data = {
'username': username or user.username,
'password': password or user.text_password,
}
client = APIClient()
response = client.post('/api/token-auth', data=sign_in_data, format='json')
token = response.data['access']
client.credentials(HTTP_AUTHORIZATION='JWT ' + token)
return client
def test_unauthorized_head(self):
client = APIClient()
response = client.head('/api/users/')
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_authorized_head(self):
client = self.authorize(self.first_user)
response = client.head('/api/users/')
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_admin_head(self):
client = self.authorize(self.admin_user)
response = client.head('/api/users/')
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_unauthorized_list(self):
client = APIClient()
response = client.get('/api/users/')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['count'], 3)
for result in response.data['results']:
self.assertEqual(tuple(result.keys()), self.basic_result_keys)
def test_authorized_list(self):
client = self.authorize(self.first_user)
response = client.get('/api/users/')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['count'], 3)
for result in response.data['results']:
self.assertEqual(tuple(result.keys()), self.full_result_keys)
def test_admin_list(self):
client = self.authorize(self.first_user)
response = client.get('/api/users/')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['count'], 3)
for result in response.data['results']:
self.assertEqual(tuple(result.keys()), self.full_result_keys)
def test_list_filter(self):
client = APIClient()
response = client.get('/api/users/?username=TestUsername1')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['count'], 1)
def test_list_search(self):
client = APIClient()
response = client.get('/api/users/?search={}'.format(self.first_user.username))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['count'], 1)
def test_unauthorized_create(self):
data = File(open('media/email_templates/default_email_template.html', 'rb'))
upload_file = SimpleUploadedFile('email_template.html', data.read(), content_type='multipart/form-data')
sign_up_data = {
'username': 'SignUpTestUsername',
'password': 'st@ngpa$$wort',
'email': 'signup@test.email',
'email_template': upload_file,
}
client = APIClient()
response = client.post(
'/api/users/',
data=sign_up_data,
content_disposition='attachment; filename=email_template.html',
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(tuple(response.data.keys()), self.basic_result_keys)
self.assertEqual(auth.get_user_model().objects.count(), 4)
self.assertEqual(len(mail.outbox), 1)
self.assertEqual(mail.outbox[0].subject, 'Registration')
os.remove(f'{settings.EMAIL_TEMPLATES_ROOT}email_template.html')
def test_authorized_create(self):
data = File(open('media/email_templates/default_email_template.html', 'rb'))
upload_file = SimpleUploadedFile('email_template.html', data.read(), content_type='multipart/form-data')
sign_up_data = {
'username': 'SignUpTestUsername',
'password': 'SignUpTestPassword',
'email': 'signup@test.email',
'email_template': upload_file,
}
client = self.authorize(self.first_user)
response = client.post(
'/api/users/',
data=sign_up_data,
content_disposition='attachment; filename=email_template.html'
)
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
self.assertEqual(auth.get_user_model().objects.count(), 3)
self.assertEqual(len(mail.outbox), 0)
def test_admin_create(self):
data = File(open('media/email_templates/default_email_template.html', 'rb'))
upload_file = SimpleUploadedFile('email_template.html', data.read(), content_type='multipart/form-data')
sign_up_data = {
'username': 'SignUpTestUsername',
'password': 'SignUpTestPassword',
'email': 'signup@test.email',
'email_template': upload_file,
}
client = self.authorize(self.admin_user)
response = client.post(
'/api/users/',
data=sign_up_data,
content_disposition='attachment; filename=email_template.html'
)
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
self.assertEqual(auth.get_user_model().objects.count(), 3)
self.assertEqual(len(mail.outbox), 0)
def test_create_without_template(self):
sign_up_data = {
'username': 'SignUpTestUsername',
'password': 'str0ngpa$$wort',
'email': 'signup@test.email',
}
client = APIClient()
response = client.post('/api/users/', data=sign_up_data, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(tuple(response.data.keys()), self.basic_result_keys)
self.assertEqual(auth.get_user_model().objects.count(), 4)
self.assertEqual(len(mail.outbox), 1)
self.assertEqual(mail.outbox[0].subject, 'Registration')
def test_unauthorized_retrieve(self):
client = APIClient()
response = client.get('/api/users/{}/'.format(self.first_user.id))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(tuple(response.data.keys()), self.basic_result_keys)
def test_authorized_retrieve(self):
client = self.authorize(self.second_user)
response = client.get('/api/users/{}/'.format(self.first_user.id))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(tuple(response.data.keys()), self.full_result_keys)
def test_owner_retrieve(self):
client = self.authorize(self.first_user)
response = client.get('/api/users/{}/'.format(self.first_user.id))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(tuple(response.data.keys()), self.full_result_keys)
def test_admin_retrieve(self):
client = self.authorize(self.admin_user)
response = client.get('/api/users/{}/'.format(self.first_user.id))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(tuple(response.data.keys()), self.full_result_keys)
def test_non_existent_retrieve(self):
client = self.authorize(self.admin_user)
response = client.get('/api/users/0/')
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
def test_unauthorized_partial_update(self):
updates = {
'username': 'NewUsername1',
}
client = APIClient()
response = client.patch('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
self.assertNotEqual(auth.get_user_model().objects.get(id=self.first_user.id).username, 'NewUsername1')
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'TestEmail1')
def test_authorized_partial_update(self):
updates = {
'username': 'NewUsername2',
}
client = self.authorize(self.second_user)
response = client.patch('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
self.assertNotEqual(auth.get_user_model().objects.get(id=self.first_user.id).username, 'NewUsername1')
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'TestEmail1')
def test_owner_partial_update(self):
updates = {
'username': 'NewUsername1',
}
client = self.authorize(self.first_user)
response = client.patch('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).username, 'NewUsername1')
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'TestEmail1')
self.assertEqual(tuple(response.data.keys()), self.full_result_keys)
def test_admin_partial_update(self):
updates = {
'username': 'NewUsername1',
}
client = self.authorize(self.admin_user)
response = client.patch('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).username, 'NewUsername1')
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'TestEmail1')
self.assertEqual(tuple(response.data.keys()), self.full_result_keys)
def test_unauthorized_reset_password(self):
data = File(open('media/email_templates/default_email_template.html', 'rb'))
upload_file = SimpleUploadedFile('email_template.html', data.read(), content_type='multipart/form-data')
updates = {
'username': 'TestUsername1',
'password': 'NewPassword1',
'email_template': upload_file,
}
client = APIClient()
response = client.post(
'/api/users/reset_password/',
data=updates,
content_disposition='attachment; filename=email_template.html',
)
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertTrue(Activation.objects.filter(user=auth.get_user_model().objects.get(id=self.first_user.id)).exists())
os.remove(f'{settings.EMAIL_TEMPLATES_ROOT}email_template.html')
def test_authorized_reset_password(self):
data = File(open('media/email_templates/default_email_template.html', 'rb'))
upload_file = SimpleUploadedFile('email_template.html', data.read(), content_type='multipart/form-data')
updates = {
'username': 'TestUsername1',
'password': 'NewPassword1',
'email_template': upload_file,
}
client = self.authorize(self.second_user)
response = client.post(
'/api/users/reset_password/',
data=updates,
content_disposition='attachment; filename=email_template.html',
)
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
self.assertFalse(Activation.objects.filter(user=auth.get_user_model().objects.get(id=self.first_user.id)).exists())
def test_owner_reset_password(self):
data = File(open('media/email_templates/default_email_template.html', 'rb'))
upload_file = SimpleUploadedFile('email_template.html', data.read(), content_type='multipart/form-data')
updates = {
'username': 'TestUsername1',
'password': 'NewPassword1',
'email_template': upload_file,
}
client = self.authorize(self.first_user)
response = client.post(
'/api/users/reset_password/',
data=updates,
content_disposition='attachment; filename=email_template.html'
)
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
self.assertFalse(Activation.objects.filter(user=auth.get_user_model().objects.get(id=self.first_user.id)).exists())
def test_admin_reset_password(self):
data = File(open('media/email_templates/default_email_template.html', 'rb'))
upload_file = SimpleUploadedFile('email_template.html', data.read(), content_type='multipart/form-data')
updates = {
'username': 'TestUsername1',
'password': 'NewPassword1',
'email_template': upload_file,
}
client = self.authorize(self.admin_user)
response = client.post(
'/api/users/reset_password/',
data=updates,
content_disposition='attachment; filename=email_template.html'
)
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
self.assertFalse(Activation.objects.filter(user=auth.get_user_model().objects.get(id=self.first_user.id)).exists())
def test_reset_password_without_template(self):
updates = {
'username': 'TestUsername1',
'password': 'NewPassword1',
}
client = APIClient()
response = client.post('/api/users/reset_password/', data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertTrue(Activation.objects.filter(user=auth.get_user_model().objects.get(id=self.first_user.id)).exists())
def test_unauthorized_reset_password_by_email(self):
data = File(open('media/email_templates/default_email_template.html', 'rb'))
upload_file = SimpleUploadedFile('email_template.html', data.read(), content_type='multipart/form-data')
updates = {
'email': 'TestEmail1',
'password': 'NewPassword1',
'email_template': upload_file,
}
client = APIClient()
response = client.post(
'/api/users/reset_password/',
data=updates,
content_disposition='attachment; filename=email_template.html'
)
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertTrue(Activation.objects.filter(user=auth.get_user_model().objects.get(id=self.first_user.id)).exists())
os.remove(f'{settings.EMAIL_TEMPLATES_ROOT}email_template.html')
def test_unauthorized_reset_password_by_username_and_email(self):
data = File(open('media/email_templates/default_email_template.html', 'rb'))
upload_file = SimpleUploadedFile('email_template.html', data.read(), content_type='multipart/form-data')
updates = {
'username': 'TestUsername1',
'email': 'TestEmail1',
'password': 'NewPassword1',
'email_template': upload_file,
}
client = APIClient()
response = client.post(
'/api/users/reset_password/',
data=updates,
content_disposition='attachment; filename=email_template.html'
)
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertTrue(Activation.objects.filter(user=auth.get_user_model().objects.get(id=self.first_user.id)).exists())
os.remove(f'{settings.EMAIL_TEMPLATES_ROOT}email_template.html')
def test_unauthorized_update(self):
updates = {
'username': 'NewUsername1',
'email': 'new@email.com',
'password': 'NewPassword',
}
client = APIClient()
response = client.put('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
self.assertNotEqual(auth.get_user_model().objects.get(id=self.first_user.id).username, 'NewUsername1')
self.assertNotEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'new@email.com')
def test_authorized_update(self):
updates = {
'username': 'NewUsername2',
'email': 'new@email.com',
'password': 'NewPassword',
}
client = self.authorize(self.second_user)
response = client.put('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
self.assertNotEqual(auth.get_user_model().objects.get(id=self.first_user.id).username, 'NewUsername1')
self.assertNotEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'new@email.com')
def test_owner_update(self):
updates = {
'username': 'NewUsername1',
'email': 'new@email.com',
'password': 'NewPassword',
}
client = self.authorize(self.first_user)
response = client.put('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertIsNone(response.data)
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).username, 'NewUsername1')
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'TestEmail1')
client = self.authorize(self.first_user, username='NewUsername1')
activation_obj = Activation.objects.filter(user=self.first_user).first()
response = client.get(f'/api/users/{activation_obj.user.id}/activation/{activation_obj.key}/')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
def test_admin_update(self):
updates = {
'username': 'NewUsername1',
'email': 'new@email.com',
'password': 'NewPassword',
}
client = self.authorize(self.admin_user)
response = client.put('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertIsNone(response.data)
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).username, 'NewUsername1')
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'TestEmail1')
activation_obj = Activation.objects.filter(user=self.first_user).first()
response = client.get(f'/api/users/{activation_obj.user.id}/activation/{activation_obj.key}/')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
def test_unauthorized_destroy(self):
client = APIClient()
response = client.delete('/api/users/{}/'.format(self.first_user.id))
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
def test_authorized_destroy(self):
client = self.authorize(self.second_user)
response = client.delete('/api/users/{}/'.format(self.first_user.id))
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
def test_owner_destroy(self):
client = self.authorize(self.first_user)
response = client.delete('/api/users/{}/'.format(self.first_user.id))
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertFalse(auth.get_user_model().objects.filter(id=1).exists())
def test_admin_destroy(self):
client = self.authorize(self.admin_user)
response = client.delete('/api/users/{}/'.format(self.first_user.id))
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertFalse(auth.get_user_model().objects.filter(id=1).exists())
def test_common_options(self):
allowed_headers = ('Allow', 'GET, POST, HEAD, OPTIONS')
client = APIClient()
response = client.options('/api/users/')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response._headers['allow'], allowed_headers)
def test_detail_options(self):
allowed_headers = ('Allow', 'GET, PUT, PATCH, DELETE, HEAD, OPTIONS')
client = APIClient()
response = client.options('/api/users/{}/'.format(self.first_user.id))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response._headers['allow'], allowed_headers)
def test_verification_activation(self):
sign_up_data = {
'username': 'SignUpTestUsername',
'password': 'blahasdblah',
'email': 'signup@test.email',
}
client = APIClient()
response = client.post('/api/users/', data=sign_up_data, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(tuple(response.data.keys()), self.basic_result_keys)
new_user = auth.get_user_model().objects.get(id=response.data['id'])
new_user.text_password = 'blahasdblah'
activation_obj = Activation.objects.filter(user=new_user).first()
response = client.get(f'/api/users/{activation_obj.user.id}/activation/{activation_obj.key}/')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.authorize(new_user)
def test_reset_password_activation(self):
updates = {
'email': 'TestEmail1',
'password': 'NewPassword1',
}
client = APIClient()
response = client.post('/api/users/reset_password/', data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertTrue(Activation.objects.filter(user=auth.get_user_model().objects.get(id=self.first_user.id)).exists())
activation_obj = Activation.objects.filter(user=self.first_user).first()
response = client.post(f'/api/users/{activation_obj.user.id}/reset_password/{activation_obj.key}/confirm/', data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.authorize(self.first_user, password='NewPassword1')
def test_owner_email_partial_update_activation(self):
updates = {
'email': 'NewEmail1@server.net',
}
client = self.authorize(self.first_user)
response = client.patch('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
activation_obj = Activation.objects.filter(user=self.first_user).first()
response = client.get(f'/api/users/{activation_obj.user.id}/activation/{activation_obj.key}/')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'NewEmail1@server.net')
def test_admin_email_partial_update_activation(self):
updates = {
'email': 'NewEmail1@server.net',
}
client = self.authorize(self.admin_user)
response = client.patch('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
activation_obj = Activation.objects.filter(user=self.first_user).first()
response = client.get(f'/api/users/{activation_obj.user.id}/activation/{activation_obj.key}/')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'NewEmail1@server.net')
def test_admin_email_partial_update_activation_with_template(self):
data = File(open('media/email_templates/default_email_template.html', 'rb'))
upload_file = SimpleUploadedFile('email_template.html', data.read(), content_type='multipart/form-data')
updates = {
'email': 'NewEmail1@server.net',
'email_template': upload_file,
}
client = self.authorize(self.admin_user)
response = client.patch(
'/api/users/{}/'.format(self.first_user.id),
data=updates,
content_disposition='attachment; filename=email_template.html',
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
activation_obj = Activation.objects.filter(user=self.first_user).first()
response = client.get(f'/api/users/{activation_obj.user.id}/activation/{activation_obj.key}/')
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertEqual(auth.get_user_model().objects.get(id=self.first_user.id).email, 'NewEmail1@server.net')
os.remove(f'{settings.EMAIL_TEMPLATES_ROOT}email_template.html')
def test_invalid_template(self):
upload_file = SimpleUploadedFile('email_template.html', b'bla-bla-bla', content_type='multipart/form-data')
updates = {
'username': 'TestUsername1',
'password': 'NewPassword1',
'email_template': upload_file,
}
client = APIClient()
response = client.post(
'/api/users/reset_password/',
data=updates,
content_disposition='attachment; filename=email_template.html'
)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_empty_partial_update(self):
updates = {}
client = self.authorize(self.first_user)
response = client.patch('/api/users/{}/'.format(self.first_user.id), data=updates, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
| 42.935938
| 144
| 0.667892
| 3,181
| 27,479
| 5.546998
| 0.061301
| 0.079909
| 0.053783
| 0.085463
| 0.902239
| 0.878322
| 0.86098
| 0.842732
| 0.820856
| 0.80187
| 0
| 0.010624
| 0.2019
| 27,479
| 639
| 145
| 43.00313
| 0.793945
| 0
| 0
| 0.69428
| 0
| 0
| 0.178027
| 0.066414
| 0
| 0
| 0
| 0
| 0.220907
| 1
| 0.092702
| false
| 0.09073
| 0.019724
| 0
| 0.116371
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 7
|
510819c79f4d238a067b709b1c181a406135bf71
| 7,795
|
py
|
Python
|
pid.py
|
elhamalamoudi/deepPID
|
a6b80abeebda3c86fd99dc37805977e8994b6c36
|
[
"MIT"
] | 5
|
2020-08-24T18:41:21.000Z
|
2022-01-02T03:46:50.000Z
|
pid.py
|
elhamalamoudi/deepPID
|
a6b80abeebda3c86fd99dc37805977e8994b6c36
|
[
"MIT"
] | null | null | null |
pid.py
|
elhamalamoudi/deepPID
|
a6b80abeebda3c86fd99dc37805977e8994b6c36
|
[
"MIT"
] | 10
|
2020-06-17T13:03:10.000Z
|
2022-02-24T07:43:35.000Z
|
import numpy as np
class pid_controller():
def __init__(self,set_point,n_actions=6, dt = 0.1):
self.dt = dt
self.actions=n_actions
self.set_point = set_point
self.action_vx = np.zeros(3)
self.action_wz = np.zeros(3)
self.u = np.zeros(6)
self.u0 = np.zeros(6)
self.error = np.zeros((3,2))
def update_action(self,actions):
self.action_vx = actions[0:3] # PIDs[0:2]
self.action_wz = actions[3:6] # PIDs[2:4]
return
def update(self, velocity):
self.velocity = velocity
self.error[2] = self.error[1]
self.error[1] = self.error[0]
self.error[0][0] = self.set_point[0] - self.velocity[0] # vx
self.error[0][1] = self.set_point[5] - self.velocity[5] # wz
self.u[0] = self.controller_pid(self.error[0][0], self.error[1][0], self.error[2][0], self.action_vx, self.u0[0])
self.u[1] = self.controller_pid(self.error[0][1], self.error[1][1], self.error[2][1], self.action_wz, self.u0[1])
self.u = np.clip(self.u, -0.8, 0.8)
self.u0[0] = self.u[0]
self.u0[1] = self.u[1]
return self.u
def controller_pid_2(self, et, et1, et2, action, u0):
# this is the old version, it was not working properly
Kp = action[0]
Ti = action[1]
Td = action[2]
k1 = Kp*(1+Td/self.dt)
k2 =-Kp*(1+2*Td/self.dt-self.dt/Ti)
k3 = Kp*(Td/Ti)
u = u0 + k1*et + k2*et1 + k3*et2
return u
def controller_pid(self, et, et1, et2, action, u0):
Kp = action[0]
Ti = action[1]
Td = action[2]
k1 = Kp*(1 + self.dt/Ti + Td/self.dt)
k2 =-Kp*(1+2*Td/self.dt)
k3 = Kp*(Td/self.dt)
u = u0 + k1*et + k2*et1 + k3*et2
return u
def reset(self):
self.action_vx = np.zeros(3)
self.action_wz = np.zeros(3)
self.u = np.zeros(6)
self.u0 = np.zeros(6)
self.error = np.zeros((3,2))
return
class pi_controller():
def __init__(self,set_point,n_actions=6, dt = 0.1):
self.dt = dt
self.actions=n_actions
self.set_point = set_point
self.action_vx = np.zeros(3)
self.action_wz = np.zeros(3)
self.u = np.zeros(6)
self.u0 = np.zeros(6)
self.error = np.zeros((3,2))
def update_action(self,actions):
self.action_vx = actions[0:2] # PIDs[0:2]
self.action_wz = actions[2:4] # PIDs[2:4]
return
def update(self, velocity):
self.velocity = velocity
self.error[2] = self.error[1]
self.error[1] = self.error[0]
self.error[0][0] = self.set_point[0] - self.velocity[0] # vx
self.error[0][1] = self.set_point[5] - self.velocity[5] # wz
self.u[0] = self.controller_pi(self.error[0][0], self.error[1][0], self.error[2][0], self.action_vx, self.u0[0])
self.u[1] = self.controller_pi(self.error[0][1], self.error[1][1], self.error[2][1], self.action_wz, self.u0[1])
self.u = np.clip(self.u, -0.8, 0.8)
self.u0[0] = self.u[0]
self.u0[1] = self.u[1]
return self.u
def controller_pi(self, et, et1, et2, action, u0):
Kp = action[0]
Ti = action[1]
Td = 0.
k1 = Kp*(1+Td/self.dt)
k2 =-Kp*(1+2*Td/self.dt-self.dt/Ti)
k3 = Kp*(Td/Ti)
u = u0 + k1*et + k2*et1 + k3*et2
return u
def reset(self):
self.action_vx = np.zeros(3)
self.action_wz = np.zeros(3)
self.u = np.zeros(6)
self.u0 = np.zeros(6)
self.error = np.zeros((3,2))
return
class pi_controller_pioneer():
def __init__(self,set_point,n_actions=6, dt = 0.1):
self.dt = dt
self.actions=n_actions
self.set_point = set_point
self.action_vx = np.zeros(2)
self.action_wz = np.zeros(2)
self.u = np.zeros(2)
self.u0 = np.zeros(2)
self.error = np.zeros((3,2))
def update_action(self,actions):
self.action_vx = actions[0:2] # PIDs[0:2]
self.action_wz = actions[2:4] # PIDs[2:4]
return
def update(self, velocity):
self.velocity = velocity
self.error[2] = self.error[1]
self.error[1] = self.error[0]
self.error[0][0] = self.set_point[0] - self.velocity[0] # vx
self.error[0][1] = self.set_point[1] - self.velocity[1] # wz
self.u[0] = self.controller_pi(self.error[0][0], self.error[1][0], self.error[2][0], self.action_vx, self.u0[0])
self.u[1] = self.controller_pi(self.error[0][1], self.error[1][1], self.error[2][1], self.action_wz, self.u0[1])
self.u = np.clip(self.u, -0.8, 0.8)
self.u0[0] = self.u[0]
self.u0[1] = self.u[1]
return self.u
def controller_pi(self, et, et1, et2, action, u0):
# this is the old version
Kp = action[0]
Ti = action[1]
Td = 0.
k1 = Kp*(1+Td/self.dt)
k2 =-Kp*(1+2*Td/self.dt-self.dt/Ti)
k3 = Kp*(Td/Ti)
u = u0 + k1*et + k2*et1 + k3*et2
return u
def controller_pi_2(self, et, et1, et2, action, u0):
Kp = action[0]
Ti = action[1]
Td = 0.
k1 = Kp*(1 + self.dt/Ti + Td/self.dt)
k2 =-Kp*(1+2*Td/self.dt)
k3 = Kp*(Td/self.dt)
u = u0 + k1*et + k2*et1 + k3*et2
return u
def reset(self):
self.action_vx = np.zeros(3)
self.action_wz = np.zeros(3)
self.u = np.zeros(6)
self.u0 = np.zeros(6)
self.error = np.zeros((3,2))
return
class pid_controller_pioneer():
def __init__(self,set_point,n_actions=6, dt = 0.1):
self.dt = dt
self.actions=n_actions
self.set_point = set_point
self.action_vx = np.zeros(3)
self.action_wz = np.zeros(3)
self.u = np.zeros(2)
self.u0 = np.zeros(2)
self.error = np.zeros((3,2))
def update_action(self,actions):
self.action_vx = actions[0:3] # PIDs[0:2]
self.action_wz = actions[3:6] # PIDs[2:4]
return
def update(self, velocity):
self.velocity = velocity
self.error[2] = self.error[1]
self.error[1] = self.error[0]
self.error[0][0] = self.set_point[0] - self.velocity[0] # vx
self.error[0][1] = self.set_point[1] - self.velocity[1] # wz
self.u[0] = self.controller_pid(self.error[0][0], self.error[1][0], self.error[2][0], self.action_vx, self.u0[0])
self.u[1] = self.controller_pid(self.error[0][1], self.error[1][1], self.error[2][1], self.action_wz, self.u0[1])
self.u = np.clip(self.u, -0.8, 0.8)
self.u0[0] = self.u[0]
self.u0[1] = self.u[1]
return self.u
def controller_pid_2(self, et, et1, et2, action, u0):
# this is the old version, it was not working properly
Kp = action[0]
Ti = action[1]
Td = action[2]
k1 = Kp*(1+Td/self.dt)
k2 =-Kp*(1+2*Td/self.dt-self.dt/Ti)
k3 = Kp*(Td/Ti)
u = u0 + k1*et + k2*et1 + k3*et2
return u
def controller_pid(self, et, et1, et2, action, u0):
Kp = action[0]
Ti = action[1]
Td = action[2]
k1 = Kp*(1 + self.dt/Ti + Td/self.dt)
k2 =-Kp*(1+2*Td/self.dt)
k3 = Kp*(Td/self.dt)
u = u0 + k1*et + k2*et1 + k3*et2
return u
def reset(self):
self.action_vx = np.zeros(3)
self.action_wz = np.zeros(3)
self.u = np.zeros(6)
self.u0 = np.zeros(6)
self.error = np.zeros((3,2))
return
| 27.839286
| 122
| 0.523669
| 1,274
| 7,795
| 3.122449
| 0.044741
| 0.126697
| 0.044243
| 0.042232
| 0.992459
| 0.987682
| 0.987682
| 0.987431
| 0.987431
| 0.987431
| 0
| 0.072642
| 0.313021
| 7,795
| 280
| 123
| 27.839286
| 0.670215
| 0.030019
| 0
| 0.959184
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.005102
| null | null | 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
513e9142ab5295398e9919fd3068027f62400fa5
| 14,426
|
py
|
Python
|
The dawn of Otrozhny/menuTabs.py
|
SeoFernando25/The-dawn-of-Otrozhny
|
b42f3ca71c477e2b76e5189e790e70c930712c24
|
[
"MIT"
] | null | null | null |
The dawn of Otrozhny/menuTabs.py
|
SeoFernando25/The-dawn-of-Otrozhny
|
b42f3ca71c477e2b76e5189e790e70c930712c24
|
[
"MIT"
] | null | null | null |
The dawn of Otrozhny/menuTabs.py
|
SeoFernando25/The-dawn-of-Otrozhny
|
b42f3ca71c477e2b76e5189e790e70c930712c24
|
[
"MIT"
] | null | null | null |
# Just placed some draw functions here because
# otherwise it would become messy
import textDraw
import renderer
import colors
import entities
def render_tutorial_tab_1():
textDraw.message_display_MB(
renderer.SCREEN,
"Enemy Status",
renderer.SCREEN_WIDTH//1.5, renderer.VIEWPORT_Y_OFFSET * 1.5,
20, color=colors.RED)
row = 0
textDraw.message_display_L(
renderer.SCREEN,
"Enemy status refers to various states of alert that",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"affect the behaviour of enemy soldiers.",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"NORMAL",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, entities.EnemyStatus.Normal.value[1])
textDraw.message_display_L(
renderer.SCREEN,
"While in Normal mode, enemy soldiers will ",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"follow a set patrol route.",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"Alert",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, entities.EnemyStatus.Alert.value[1])
textDraw.message_display_L(
renderer.SCREEN,
"This is the state in which the player has",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"been discovered by enemy soldiers. ",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"enemy soldiers call for backup and attack.",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"Evasion",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, entities.EnemyStatus.Evasion.value[1])
textDraw.message_display_L(
renderer.SCREEN,
"Enemy soldiers will search the area",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"they last found the player",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"Caution",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, entities.EnemyStatus.Caution.value[1])
textDraw.message_display_L(
renderer.SCREEN,
"Enemy soldiers will search the vicinity",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"after losing sight of the player",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
def render_tutorial_tab_2():
textDraw.message_display_MB(
renderer.SCREEN,
"Map Editor",
renderer.SCREEN_WIDTH//1.5, renderer.VIEWPORT_Y_OFFSET * 1.5,
20, color=colors.RED)
row = 0
textDraw.message_display_L(
renderer.SCREEN,
"You can create and edit you levels in the level",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"editor. You can share maps through the maps folder.",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"NAV",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, colors.YELLOW)
textDraw.message_display_L(
renderer.SCREEN,
"You can edit and change node conections.",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"Making soldiers follow a set patrol route.",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"Draw",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, colors.YELLOW)
textDraw.message_display_L(
renderer.SCREEN,
"In draw mode you can add and remove",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"walls, as well as enemies and nodes",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"Wall",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, colors.YELLOW)
textDraw.message_display_L(
renderer.SCREEN,
"You can paint walls and add keys to them",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"Options",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, colors.YELLOW)
textDraw.message_display_L(
renderer.SCREEN,
"You can edit the settings of your map ",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"such as width and height",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
def render_tutorial_tab_3():
textDraw.message_display_MB(
renderer.SCREEN,
"Items and Objects",
renderer.SCREEN_WIDTH//1.5, renderer.VIEWPORT_Y_OFFSET * 1.5,
20, color=colors.RED)
row = 0
textDraw.message_display_L(
renderer.SCREEN,
"While on missions, you may find a variety of ",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"items and obstacles",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"Keys",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, colors.YELLOW)
textDraw.message_display_L(
renderer.SCREEN,
"Keys can open gates and allow you to",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"pass through before locked areas.",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"Gates",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, colors.YELLOW)
textDraw.message_display_L(
renderer.SCREEN,
"Gates block your path and may restrict",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"your way to an advantage point",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"Stars",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, colors.YELLOW)
textDraw.message_display_L(
renderer.SCREEN,
"Are collectables scattered around the",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"map. You need to collect all of them to",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"complete a mission",
renderer.VIEWPORT_X_OFFSET * 10, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
def render_tutorial_tab_4():
textDraw.message_display_MB(
renderer.SCREEN,
"Briefing",
renderer.SCREEN_WIDTH//1.5, renderer.VIEWPORT_Y_OFFSET * 1.5,
20, color=colors.RED)
row = 0
textDraw.message_display_L(
renderer.SCREEN,
"JULY 2019: The human species is on the edge of",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"extinction. ",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"A geneticaly modified creature created by Kephart",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"corporations of Keter class named by SPC-610 was",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"recently denounced uncontained of level Red after",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"members from Area-683 lost direct contact to",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"I DATA EXPUNGED I . Locals from Otrozhny in the ",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"Russia Confederation also recently reported ",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"anomalous sounds comming from Area-683.",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"Fortunately, one of the officers was able to",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"contact HQ via a 2000 MK VI Transreciever.",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"More details will be availible ASAP",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"I End of transmission I",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
def render_tutorial_tab_5():
textDraw.message_display_MB(
renderer.SCREEN,
"Unauthorized",
renderer.SCREEN_WIDTH//1.5, renderer.VIEWPORT_Y_OFFSET * 1.5,
20, color=colors.RED)
row = 0
textDraw.message_display_L(
renderer.SCREEN,
"Error 401 - Unauthorized",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, colors.RED)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"You do not have permission to view this directory",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12, color=colors.RED)
row += 2
textDraw.message_display_L(
renderer.SCREEN,
"olssv, ty ztpao",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"pm fvb hyl zllpun aopz tlzzhnl jvunyhabshapvuz.",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"bumvyabuhalsf, aol zavyf pz zapss pujvtwslal ",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"huk pa thf ulcly dpss p zhk ltvqp p . wslhzl ",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
row += 1
textDraw.message_display_L(
renderer.SCREEN,
"jvtl ihjr shaly.",
renderer.VIEWPORT_X_OFFSET, renderer.VIEWPORT_Y_OFFSET * 2 + 20 * row,
12)
| 31.497817
| 84
| 0.601345
| 1,736
| 14,426
| 4.766705
| 0.145737
| 0.241692
| 0.17281
| 0.180665
| 0.812447
| 0.811722
| 0.785619
| 0.781269
| 0.770151
| 0.76858
| 0
| 0.045956
| 0.315195
| 14,426
| 457
| 85
| 31.56674
| 0.791679
| 0.005338
| 0
| 0.791123
| 0
| 0
| 0.139329
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.013055
| false
| 0.002611
| 0.010444
| 0
| 0.023499
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 1
| 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
| 9
|
51487c8d1e6f5ed35bf205f07fbd7463e41233bc
| 150
|
py
|
Python
|
kfac/modules/__init__.py
|
saeedsoori/kfac_pytorch
|
a49d6f30daf6d1e989df9b13e1ca42f1d0742a44
|
[
"MIT"
] | 35
|
2020-05-15T16:51:23.000Z
|
2022-02-23T20:23:44.000Z
|
kfac/modules/__init__.py
|
MLHPC/Distributed_KFAC_Pytorch
|
cfd6d54012cf23d832818ce302d2d2d049da4936
|
[
"MIT"
] | 18
|
2020-04-27T19:36:05.000Z
|
2022-03-25T22:14:16.000Z
|
kfac/modules/__init__.py
|
MLHPC/Distributed_KFAC_Pytorch
|
cfd6d54012cf23d832818ce302d2d2d049da4936
|
[
"MIT"
] | 14
|
2020-05-24T17:22:14.000Z
|
2022-03-17T19:31:07.000Z
|
from .lstm import LSTM, LSTMCellBase, LSTMCellKFAC, LSTMCell, LSTMLayer
__all__ = ['LSTM', 'LSTMCellBase', 'LSTMCellKFAC', 'LSTMCell', 'LSTMLayer']
| 30
| 75
| 0.74
| 14
| 150
| 7.642857
| 0.571429
| 0.299065
| 0.523364
| 0.672897
| 0.841122
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.113333
| 150
| 4
| 76
| 37.5
| 0.804511
| 0
| 0
| 0
| 0
| 0
| 0.302013
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 1
| 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
| 7
|
5aa29f5cfc53ae5b3c761ca50474349257001bba
| 140
|
py
|
Python
|
code/solve_single_lin.py
|
thanever/DID
|
018d901ec8a4d47645c83ab1807ed2e345829ad7
|
[
"MIT"
] | null | null | null |
code/solve_single_lin.py
|
thanever/DID
|
018d901ec8a4d47645c83ab1807ed2e345829ad7
|
[
"MIT"
] | null | null | null |
code/solve_single_lin.py
|
thanever/DID
|
018d901ec8a4d47645c83ab1807ed2e345829ad7
|
[
"MIT"
] | 1
|
2021-10-03T04:14:48.000Z
|
2021-10-03T04:14:48.000Z
|
def solve_single_lin(opt_x_s):
'''
solve one opt_x[s]
'''
opt_x_s.solve(solver='MOSEK', verbose = True)
return opt_x_s
| 17.5
| 49
| 0.621429
| 24
| 140
| 3.25
| 0.541667
| 0.205128
| 0.25641
| 0.25641
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.242857
| 140
| 8
| 50
| 17.5
| 0.735849
| 0.128571
| 0
| 0
| 0
| 0
| 0.046729
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.666667
| 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
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 7
|
5ab75873a3c8b28eb0dd0d7210e12d8c50fc10ae
| 3,728
|
py
|
Python
|
results_plots/fall2021/dist_vs_inner_steps_neurips_workshop.py
|
brando90/Does-MAML-Only-Work-via-Feature-Re-use-A-Data-Set-Centric-Perspective
|
45c4fabf35d6d8d19e49092e84e8ac9fa55aee8d
|
[
"MIT"
] | null | null | null |
results_plots/fall2021/dist_vs_inner_steps_neurips_workshop.py
|
brando90/Does-MAML-Only-Work-via-Feature-Re-use-A-Data-Set-Centric-Perspective
|
45c4fabf35d6d8d19e49092e84e8ac9fa55aee8d
|
[
"MIT"
] | null | null | null |
results_plots/fall2021/dist_vs_inner_steps_neurips_workshop.py
|
brando90/Does-MAML-Only-Work-via-Feature-Re-use-A-Data-Set-Centric-Perspective
|
45c4fabf35d6d8d19e49092e84e8ac9fa55aee8d
|
[
"MIT"
] | null | null | null |
# %%
# ml + loss vs inner steps (Sigmoid best val)
import numpy as np
import matplotlib.pyplot as plt
from pylab import MaxNLocator
from pathlib import Path
print('running')
save_plot = True
# save_plot = False
# - data for distance
inner_steps_for_dist = [1, 2, 4, 8, 16, 32]
meta_test_cca = [0.2801, 0.2866, 0.2850, 0.2848, 0.2826, 0.2914]
meta_test_cca_std = [0.0351, 0.0336, 0.0322, 0.0341, 0.0321, 0.0390]
# - data for meta-lost
inner_steps_for_loss = [0, 1, 2, 4, 8, 16, 32]
loss_maml0 = 43.43485323588053
meta_test_loss = [loss_maml0, 10.404328906536103, 4.988216777642568, 5.07447034517924, 5.449032692114512, 5.36303452650706, 4.339294484257698]
# - create plot
fig, axs = plt.subplots(2, 1, sharex=True, tight_layout=True)
axs[0].errorbar(inner_steps_for_dist, meta_test_cca, yerr=meta_test_cca_std, marker='x', label='dCCA')
# axs[0].errorbar(inner_steps_for_dist, meta_test_ned, yerr=meta_test_ned_std, marker='x', label='NED')
axs[0].axhline(y=0.12, color='r', linestyle='--', label='dCCA previous work [15]')
axs[0].legend()
axs[0].set_title('Representation difference vs adaption\'s inner steps ')
axs[0].set_ylabel('Represenation change')
# axs[0].set_ylim([0, 1])
axs[1].plot(inner_steps_for_loss, meta_test_loss, marker='x', label='loss', color='g')
axs[1].set_title('Meta-Validation loss vs adaptation\'s inner steps')
axs[1].set_xlabel('adaptation\'s inner steps')
axs[1].set_ylabel('Loss')
# axs[1].axhline(y=loss_maml0, color='g', linestyle='--', label='not adaptated')
axs[1].get_xaxis().set_major_locator(MaxNLocator(integer=True))
axs[1].legend()
plt.tight_layout()
if save_plot:
root = Path('~/Desktop').expanduser()
plt.savefig(root / 'ml_loss_vs_inner_steps_sigmoid_best.png')
plt.savefig(root / 'ml_loss_vs_inner_steps_sigmoid_best.svg')
plt.savefig(root / 'ml_loss_vs_inner_steps_sigmoid_best.pdf')
plt.show()
#%%
# ml + loss vs inner steps (ReLU best net)
import numpy as np
import matplotlib.pyplot as plt
from pylab import MaxNLocator
from pathlib import Path
print('running')
save_plot = True
# save_plot = False
# - data for distance
inner_steps_for_dist = [1, 2, 4, 8, 16, 32]
meta_test_cca = [0.2876, 0.2962, 0.2897, 0.3086, 0.2951, 0.3024]
meta_test_cca_std = [0.0585, 0.0649, 0.0575, 0.0625, 0.0565, 0.0620]
# - data for meta-loss
inner_steps_for_loss = [0, 1, 2, 4, 8, 16, 32]
loss_maml0 = 19.27044554154078
# loss_maml0_std = 1.019144981585053
meta_test_loss = [loss_maml0,
5.545517734686533, 7.434794012705485, 6.754467636346817, 6.577781716982524, 3.731084116299947, 6.21407161851724]
# plt.title("Meta-test vs Depth of ResNet")
fig, axs = plt.subplots(2, 1, sharex=True, tight_layout=True)
axs[0].errorbar(inner_steps_for_dist, meta_test_cca, yerr=meta_test_cca_std, marker='x', label='dCCA')
axs[0].axhline(y=0.12, color='r', linestyle='--', label='dCCA previous work [15]')
axs[0].legend()
axs[0].set_title('Representation difference vs adaption\'s inner steps ')
axs[0].set_ylabel('Represenation change')
# axs[0].set_ylim([0, 1])
axs[1].plot(inner_steps_for_loss, meta_test_loss, marker='x', label='loss', color='g')
axs[1].set_title('Meta-Validation loss vs adaptation\'s inner steps')
axs[1].set_xlabel('adaptation\'s inner steps')
axs[1].set_ylabel('Loss')
# axs[1].axhline(y=loss_maml0, color='g', linestyle='--', label='not adaptated')
axs[1].get_xaxis().set_major_locator(MaxNLocator(integer=True))
axs[1].legend()
plt.tight_layout()
if save_plot:
root = Path('~/Desktop').expanduser()
plt.savefig(root / 'ml_loss_vs_inner_steps_relu_best.png')
plt.savefig(root / 'ml_loss_vs_inner_steps_relu_best.svg')
plt.savefig(root / 'ml_loss_vs_inner_steps_relu_best.pdf')
plt.show()
print('done')
| 31.327731
| 142
| 0.72559
| 624
| 3,728
| 4.123397
| 0.238782
| 0.08939
| 0.045472
| 0.04042
| 0.802565
| 0.774582
| 0.774582
| 0.753206
| 0.753206
| 0.740381
| 0
| 0.134627
| 0.115343
| 3,728
| 119
| 143
| 31.327731
| 0.645543
| 0.162554
| 0
| 0.75
| 0
| 0.046875
| 0.177513
| 0.072487
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.125
| 0
| 0.125
| 0.046875
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
5adce3c727491251c9abf4ace3f6cc7ed99e2faf
| 18,549
|
py
|
Python
|
cifar10.py
|
QFaceblue/keras-yolo3
|
cbb83adc103ed80f40e0d8d88a597d72def9dd3c
|
[
"MIT"
] | null | null | null |
cifar10.py
|
QFaceblue/keras-yolo3
|
cbb83adc103ed80f40e0d8d88a597d72def9dd3c
|
[
"MIT"
] | null | null | null |
cifar10.py
|
QFaceblue/keras-yolo3
|
cbb83adc103ed80f40e0d8d88a597d72def9dd3c
|
[
"MIT"
] | null | null | null |
import keras
from keras import backend as K
from keras import optimizers, regularizers
from keras.datasets import cifar10, cifar100
from keras.models import Sequential,Model,load_model
from keras.layers import Conv2D, Dense, Flatten, MaxPooling2D,GlobalAveragePooling2D, Input, Activation,Dropout
from keras.layers.normalization import BatchNormalization
from keras.callbacks import LearningRateScheduler, TensorBoard, ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
from keras.optimizers import Adam
from keras.preprocessing.image import ImageDataGenerator
from ghostnet import ghost_body, ghostBottleneck, my_ghostBottleneck,ghostnet
# Total params: 2,756,866
# Trainable params: 2,736,866
# Non-trainable params: 20,000
# Total params: 2,534,466
# Trainable params: 2,517,026
# Non-trainable params: 17,440
def ghost_model(class_num=10):
inputs = Input(shape=(32, 32, 3))
x = ghost_body(inputs,mul=1,ratio=2)
x = GlobalAveragePooling2D()(x)
x = Dense(128)(x)
x = BatchNormalization()(x)
x = Activation("relu")(x)
# x = Dropout(0.2)(x)
x = Dense(class_num)(x)
x = Activation("softmax")(x)
model = Model(inputs,x)
sgd = optimizers.SGD(lr=.1, momentum=0.9, nesterov=True)
# 评价函数用于评估当前训练模型的性能。当模型编译后(compile),评价函数应该作为 metrics 的参数来输入。
# 评价函数和 损失函数 相似,只不过评价函数的结果不会用于训练过程中。
# model.compile(optimizer=Adam(lr=1e-1), loss='categorical_crossentropy', metrics=['accuracy'])
model.compile(optimizer=sgd, loss='categorical_crossentropy', metrics=['accuracy'])
return model
# Total params: 72,250
# Trainable params: 69,786
# Non-trainable params: 2,464
def cifar10_model():
cfgs = [
# k, t, c, SE, s
[3, 16, 16, 0, 1],
[3, 48, 24, 0, 2],
[3, 72, 24, 0, 1],
[5, 72, 40, 1, 2],
[5, 120, 40, 1, 1],
[3, 240, 80, 0, 2],
[3, 200, 80, 0, 1]
]
inputs = Input(shape=(32, 32, 3))
x = Conv2D(16 , 3, strides=2, padding="SAME", use_bias=False)(inputs)
x = BatchNormalization()(x)
x = Activation("relu")(x)
# cifar cfgs
for k, exp_size, c, use_se, s in cfgs:
output_channel = c
hidden_channel = exp_size
x = ghostBottleneck(x, hidden_channel, output_channel, kernel_size=k, use_se=use_se, strides=s)
x = GlobalAveragePooling2D()(x)
# x = Dense(128)(x)
# x = BatchNormalization()(x)
# x = Activation("relu")(x)
# x = Dropout(0.2)(x)
x = Dense(10)(x)
x = Activation("softmax")(x)
model = Model(inputs,x)
sgd = optimizers.SGD(lr=.1, momentum=0.9, nesterov=True)
# 评价函数用于评估当前训练模型的性能。当模型编译后(compile),评价函数应该作为 metrics 的参数来输入。
# 评价函数和 损失函数 相似,只不过评价函数的结果不会用于训练过程中。
model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy'])
return model
# Total params: 136,826
# Trainable params: 132,986
# Non-trainable params: 3,840
def cifar10_model2():
cfgs = [
# k, t, c, SE, s
[3, 16, 16, 0, 1],
[3, 48, 24, 0, 2],
[3, 72, 24, 0, 1],
[5, 72, 40, 1, 2],
[3, 120, 40, 1, 1],
[3, 240, 80, 0, 2],
[3, 240, 80, 0, 1],
[3, 320, 160, 0, 2]
]
inputs = Input(shape=(32, 32, 3))
x = Conv2D(8 , 3, strides=1, padding="SAME", use_bias=False)(inputs)
x = BatchNormalization()(x)
x = Activation("relu")(x)
# cifar cfgs
for k, exp_size, c, use_se, s in cfgs:
output_channel = c
hidden_channel = exp_size
x = ghostBottleneck(x, hidden_channel, output_channel, kernel_size=k, use_se=use_se, strides=s)
x = GlobalAveragePooling2D()(x)
# x = Dense(128)(x)
# x = BatchNormalization()(x)
# x = Activation("relu")(x)
x = Dropout(0.1)(x)
x = Dense(10)(x)
x = Activation("softmax")(x)
model = Model(inputs,x)
sgd = optimizers.SGD(lr=.1, momentum=0.9, nesterov=True)
# 评价函数用于评估当前训练模型的性能。当模型编译后(compile),评价函数应该作为 metrics 的参数来输入。
# 评价函数和 损失函数 相似,只不过评价函数的结果不会用于训练过程中。
model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy'])
return model
# Total params: 932,002
# Trainable params: 925,346
# Non-trainable params: 6,656
def cifar10_model3(wd=1):
cfgs = [
# k, t, c, SE, s
[3, 32, 16, 1, 1],
[3, 64, 32, 0, 2],
[3, 64, 32, 0, 1],
[3, 64, 32, 1, 1],
[3, 128, 64, 0, 2],
[3, 128, 64, 0, 1],
[3, 128, 64, 0, 1],
[3, 128, 64, 1, 1],
[3, 256, 128, 0, 2],
[3, 256, 128, 0, 1],
[3, 256, 128, 0, 1],
[3, 256, 128, 0, 1],
[3, 256, 128, 1, 1]
]
weight_decay = 1e-4
inputs = Input(shape=(32, 32, 3))
x = Conv2D(int(16*wd) , 3, strides=1, padding="SAME", use_bias=False,kernel_regularizer=regularizers.l2(weight_decay))(inputs)
x = BatchNormalization()(x)
x = Activation("relu")(x)
# cifar cfgs
for k, exp_size, c, use_se, s in cfgs:
output_channel = int(c*wd)
hidden_channel = int(exp_size*wd)
x = my_ghostBottleneck(x, hidden_channel, output_channel, kernel_size=k, use_se=use_se, strides=s,kernel_regularizer=regularizers.l2(weight_decay))
x = GlobalAveragePooling2D()(x)
x = Dense(64,kernel_regularizer=regularizers.l2(weight_decay))(x)
x = BatchNormalization()(x)
x = Activation("relu")(x)
x = Dropout(0.2)(x)
x = Dense(10,kernel_regularizer=regularizers.l2(weight_decay))(x)
x = Activation("softmax")(x)
model = Model(inputs,x)
sgd = optimizers.SGD(lr=.1, momentum=0.9, nesterov=True)
# 评价函数用于评估当前训练模型的性能。当模型编译后(compile),评价函数应该作为 metrics 的参数来输入。
# 评价函数和 损失函数 相似,只不过评价函数的结果不会用于训练过程中。
model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy'])
return model
# wd=1
# Total params: 290,978
# # Trainable params: 284,322
# # Non-trainable params: 6,656
# wd=0.5
# Total params: 84,278
# Trainable params: 80,886
# Non-trainable params: 3,392
def cifar10_model4(wd=1):
cfgs = [
# k, t, c, SE, s
[3, 32, 16, 1, 1],
[3, 64, 32, 0, 2],
[3, 64, 32, 0, 1],
[3, 64, 32, 1, 1],
[3, 128, 64, 0, 2],
[3, 128, 64, 0, 1],
[3, 128, 64, 0, 1],
[3, 128, 64, 1, 1],
[3, 256, 128, 0, 2],
[3, 256, 128, 0, 1],
[3, 256, 128, 0, 1],
[3, 256, 128, 0, 1],
[3, 256, 128, 1, 1]
]
weight_decay = 1e-4
# wd = K.cast(wd,dtype='float32')
inputs = Input(shape=(32, 32, 3))
x = Conv2D(int(16 * wd), 3, strides=1, padding="SAME", use_bias=False,kernel_regularizer=regularizers.l2(weight_decay))(inputs)
x = BatchNormalization()(x)
x = Activation("relu")(x)
# cifar cfgs
for k, exp_size, c, use_se, s in cfgs:
output_channel = int(c *wd)
hidden_channel = int(exp_size * wd)
x = ghostBottleneck(x, hidden_channel, output_channel, kernel_size=k, use_se=use_se, strides=s,kernel_regularizer=regularizers.l2(weight_decay))
x = GlobalAveragePooling2D()(x)
x = Dense(64,kernel_regularizer=regularizers.l2(weight_decay))(x)
x = BatchNormalization()(x)
x = Activation("relu")(x)
# x = Dropout(0.2)(x)
x = Dense(10,kernel_regularizer=regularizers.l2(weight_decay))(x)
x = Activation("softmax")(x)
model = Model(inputs,x)
sgd = optimizers.SGD(lr=.1, momentum=0.9, nesterov=True)
# 评价函数用于评估当前训练模型的性能。当模型编译后(compile),评价函数应该作为 metrics 的参数来输入。
# 评价函数和 损失函数 相似,只不过评价函数的结果不会用于训练过程中。
model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy'])
return model
def color_preprocessing(x_train,x_test):
x_train = x_train.astype('float32')
x_test = x_test.astype('float32')
mean = [125.307, 122.95, 113.865]
std = [62.9932, 62.0887, 66.7048]
for i in range(3):
x_train[:,:,:,i] = (x_train[:,:,:,i] - mean[i]) / std[i]
x_test[:,:,:,i] = (x_test[:,:,:,i] - mean[i]) / std[i]
return x_train, x_test
def scheduler(epoch):
if epoch < 30:
return 0.1
if epoch < 60:
return 0.01
if epoch < 90:
return 0.005
return 0.001
def scheduler2(epoch):
if epoch < 81:
return 0.1
if epoch < 122:
return 0.01
return 0.001
def scheduler3(epoch):
if epoch < 50:
return 0.1
if epoch < 90:
return 0.01
return 0.001
def scheduler4(epoch):
if epoch < 60:
return 0.1
if epoch < 100:
return 0.01
return 0.001
def scheduler5(epoch):
if epoch < 5:
return 0.0005
return 0.0001
# without preprocess
def main():
# load data
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
y_train = keras.utils.to_categorical(y_train, 10)
y_test = keras.utils.to_categorical(y_test, 10)
x_train = x_train.astype('float32')
x_test = x_test.astype('float32')
x_train /= 255.0
x_test /= 255.0
log_dir = 'logs/cifar10/333/'
# build network
model = ghost_model()
# model = cifar10_model2()
# print(model.summary())
# print(model.output)
# set callback
checkpoint = ModelCheckpoint(
log_dir + 'ep{epoch:03d}-loss{loss:.3f}-acc{acc:.3f}-val_loss{val_loss:.3f}-val_acc{val_acc:.3f}.h5',
monitor='val_acc', save_weights_only=True, save_best_only=True, period=10)
tb_cb = TensorBoard(log_dir=log_dir)
change_lr = LearningRateScheduler(scheduler) # 调整lr
# 根据条件提前停止
# early_stopping = EarlyStopping(monitor='val_loss', min_delta=0, patience=3, verbose=1)
cbks = [checkpoint, tb_cb, change_lr]
# start train
model.fit(x_train, y_train,
batch_size=128,
epochs=128,
callbacks=cbks,
validation_data=(x_test, y_test),
shuffle=True)
# save model
model.save(log_dir + 'ghostnet_cifar10.h5')
# with preprocess
def main2():
# load data
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
y_train = keras.utils.to_categorical(y_train, 10)
y_test = keras.utils.to_categorical(y_test, 10)
# color preprocessing
x_train, x_test = color_preprocessing(x_train, x_test)
log_dir = 'logs/cifar10/999/'
# weight_dir = "logs/cifar10/888/cifar10_model3_wr.h5"
# build network
# model = ghost_model()
model = cifar10_model3()
# model.load_weights(weight_dir)
# print(model.summary())
# # print(model.output)
# set callback
checkpoint = ModelCheckpoint(
log_dir + 'ep{epoch:03d}-loss{loss:.3f}-acc{acc:.3f}-val_loss{val_loss:.3f}-val_acc{val_acc:.3f}.h5',
monitor='val_acc', save_weights_only=True, save_best_only=True, period=20)
tb_cb = TensorBoard(log_dir=log_dir)
change_lr = LearningRateScheduler(scheduler4) # 调整lr
# reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=3, verbose=1)
cbks = [checkpoint, tb_cb, change_lr]
# set data augmentation
datagen = ImageDataGenerator(horizontal_flip=True,
width_shift_range=0.125,
height_shift_range=0.125,
fill_mode='constant', cval=0.)
datagen.fit(x_train)
# start training
model.fit_generator(datagen.flow(x_train, y_train, batch_size=128),
steps_per_epoch=len(x_train)//128,
epochs=128,
callbacks=cbks,
validation_data=(x_test, y_test))
# save model
# model.save(log_dir + 'cifar10_model3_wr.h5')
model.save_weights(log_dir + 'cifar10_model3_wr_d0.2.h5')
# with ReduceLROnPlateau EarlyStopping
def main3():
# load data
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
y_train = keras.utils.to_categorical(y_train, 10)
y_test = keras.utils.to_categorical(y_test, 10)
# color preprocessing
x_train, x_test = color_preprocessing(x_train, x_test)
log_dir = 'logs/cifar10/444/'
# weight_dir = "logs/cifar10/888/cifar10_model3_wr.h5"
# build network
model = cifar10_model4(wd=0.5)
# model.load_weights(weight_dir)
# print(model.summary())
# set callback
checkpoint = ModelCheckpoint(
log_dir + 'ep{epoch:03d}-loss{loss:.3f}-acc{acc:.3f}-val_loss{val_loss:.3f}-val_acc{val_acc:.3f}.h5',
monitor='val_acc', save_weights_only=True, save_best_only=True, period=20)
tb_cb = TensorBoard(log_dir=log_dir)
# change_lr = LearningRateScheduler(scheduler4) # 调整lr
reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=4, verbose=1)# min_lr=1e-4,
early_stopping = EarlyStopping(monitor='val_loss', min_delta=0, patience=10, verbose=1)
cbks = [checkpoint, tb_cb, reduce_lr,early_stopping]
# set data augmentation
datagen = ImageDataGenerator(horizontal_flip=True,
width_shift_range=0.125,
height_shift_range=0.125,
fill_mode='constant', cval=0.)
datagen.fit(x_train)
# start training
model.fit_generator(datagen.flow(x_train, y_train, batch_size=128),
steps_per_epoch=len(x_train)//128,
epochs=128,
callbacks=cbks,
validation_data=(x_test, y_test))
# save model
model.save_weights(log_dir + 'cifar10_model4_wr_wd0.5.h5')
def main4():
# load data
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
y_train = keras.utils.to_categorical(y_train, 10)
y_test = keras.utils.to_categorical(y_test, 10)
# color preprocessing
x_train, x_test = color_preprocessing(x_train, x_test)
log_dir = 'logs/cifar10/000/'
# weight_dir = "logs/cifar10/888/cifar10_model3_wr.h5"
# build network
model = ghost_model()
# model = ghostnet(mul=1, ratio=2,class_num=10)
# model.compile(optimizer=Adam(lr=1e-1), loss='categorical_crossentropy', metrics=['accuracy'])
# model.load_weights(weight_dir)
# print(model.summary())
# set callback
checkpoint = ModelCheckpoint(
log_dir + 'ep{epoch:03d}-loss{loss:.3f}-acc{acc:.3f}-val_loss{val_loss:.3f}-val_acc{val_acc:.3f}.h5',
monitor='val_acc', save_weights_only=True, save_best_only=True, period=20)
tb_cb = TensorBoard(log_dir=log_dir)
# change_lr = LearningRateScheduler(scheduler4) # 调整lr
reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=4, verbose=1)# min_lr=1e-4,
early_stopping = EarlyStopping(monitor='val_loss', min_delta=0, patience=10, verbose=1)
cbks = [checkpoint, tb_cb, reduce_lr,early_stopping]
# set data augmentation
datagen = ImageDataGenerator(horizontal_flip=True,
width_shift_range=0.125,
height_shift_range=0.125,
fill_mode='constant', cval=0.)
datagen.fit(x_train)
# start training
model.fit_generator(datagen.flow(x_train, y_train, batch_size=128),
steps_per_epoch=len(x_train)//128,
epochs=128,
callbacks=cbks,
validation_data=(x_test, y_test))
# save model
model.save_weights(log_dir + 'ghostnet_cifar10.h5')
def main5():
# load data
(x_train, y_train), (x_test, y_test) = cifar100.load_data()
y_train = keras.utils.to_categorical(y_train, 100)
y_test = keras.utils.to_categorical(y_test, 100)
# color preprocessing
x_train, x_test = color_preprocessing(x_train, x_test)
log_dir = 'logs/cifar100/111/'
# weight_dir = "logs/cifar10/888/cifar10_model3_wr.h5"
# build network
model = ghost_model(100)
# model = ghostnet(mul=1, ratio=2,class_num=10)
# model.compile(optimizer=Adam(lr=1e-1), loss='categorical_crossentropy', metrics=['accuracy'])
# model.load_weights(weight_dir)
# print(model.summary())
# set callback
checkpoint = ModelCheckpoint(
log_dir + 'ep{epoch:03d}-loss{loss:.3f}-acc{acc:.3f}-val_loss{val_loss:.3f}-val_acc{val_acc:.3f}.h5',
monitor='val_acc', save_weights_only=True, save_best_only=True, period=20)
tb_cb = TensorBoard(log_dir=log_dir)
# change_lr = LearningRateScheduler(scheduler4) # 调整lr
reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=4, verbose=1)# min_lr=1e-4,
early_stopping = EarlyStopping(monitor='val_loss', min_delta=0, patience=10, verbose=1)
cbks = [checkpoint, tb_cb, reduce_lr,early_stopping]
# set data augmentation
datagen = ImageDataGenerator(horizontal_flip=True,
width_shift_range=0.125,
height_shift_range=0.125,
fill_mode='constant', cval=0.)
datagen.fit(x_train)
# start training
model.fit_generator(datagen.flow(x_train, y_train, batch_size=128),
steps_per_epoch=len(x_train)//128,
epochs=128,
callbacks=cbks,
validation_data=(x_test, y_test))
# save model
model.save_weights(log_dir + 'ghostnet_cifar100.h5')
# without preprocess
def main6():
# load data
(x_train, y_train), (x_test, y_test) = cifar100.load_data()
y_train = keras.utils.to_categorical(y_train, 100)
y_test = keras.utils.to_categorical(y_test, 100)
x_train = x_train.astype('float32')
x_test = x_test.astype('float32')
x_train /= 255.0
x_test /= 255.0
log_dir = 'logs/cifar100/333/'
# build network
model = ghost_model(100)
# model = cifar10_model2()
# print(model.summary())
# print(model.output)
# set callback
checkpoint = ModelCheckpoint(
log_dir + 'ep{epoch:03d}-loss{loss:.3f}-acc{acc:.3f}-val_loss{val_loss:.3f}-val_acc{val_acc:.3f}.h5',
monitor='val_acc', save_weights_only=True, save_best_only=True, period=10)
tb_cb = TensorBoard(log_dir=log_dir)
# change_lr = LearningRateScheduler(scheduler4) # 调整lr
reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=4, verbose=1) # min_lr=1e-4,
early_stopping = EarlyStopping(monitor='val_loss', min_delta=0, patience=10, verbose=1)
cbks = [checkpoint, tb_cb, reduce_lr, early_stopping]
# start train
model.fit(x_train, y_train,
batch_size=128,
epochs=128,
callbacks=cbks,
validation_data=(x_test, y_test),
shuffle=True)
# save model
model.save(log_dir + 'ghostnet_cifar100.h5')
if __name__ == '__main__':
main5()
| 36.585799
| 155
| 0.626611
| 2,575
| 18,549
| 4.331262
| 0.111068
| 0.021519
| 0.014346
| 0.012911
| 0.856362
| 0.834125
| 0.823904
| 0.810006
| 0.801937
| 0.801937
| 0
| 0.076645
| 0.238234
| 18,549
| 506
| 156
| 36.658103
| 0.712668
| 0.187234
| 0
| 0.760479
| 0
| 0.017964
| 0.079539
| 0.0468
| 0
| 0
| 0
| 0
| 0
| 1
| 0.050898
| false
| 0
| 0.032934
| 0
| 0.146707
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
51ad50f1d91a2099a5a0112f44a6ad1948ec0956
| 113
|
py
|
Python
|
openselfsup/version.py
|
yoyoyoohh/PolSAR_SelfSup
|
281b40a6500fde5b4837247015edab3a5e32dbfb
|
[
"Apache-2.0"
] | 1
|
2022-02-16T01:37:17.000Z
|
2022-02-16T01:37:17.000Z
|
openselfsup/version.py
|
yoyoyoohh/PolSAR_SelfSup
|
281b40a6500fde5b4837247015edab3a5e32dbfb
|
[
"Apache-2.0"
] | null | null | null |
openselfsup/version.py
|
yoyoyoohh/PolSAR_SelfSup
|
281b40a6500fde5b4837247015edab3a5e32dbfb
|
[
"Apache-2.0"
] | null | null | null |
# GENERATED VERSION FILE
# TIME: Tue Oct 26 14:07:11 2021
__version__ = '0.3.0+dc45206'
short_version = '0.3.0'
| 18.833333
| 32
| 0.699115
| 21
| 113
| 3.52381
| 0.714286
| 0.216216
| 0.243243
| 0.27027
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.242105
| 0.159292
| 113
| 5
| 33
| 22.6
| 0.536842
| 0.469027
| 0
| 0
| 1
| 0
| 0.315789
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
51af1402bd138a0d43f31650c79c2fa00544952d
| 22,582
|
py
|
Python
|
ctplanet/Hydrostatic.py
|
AlbertoJimenezDiaz/ctplanet
|
66651288abfb2c8588aec3bca1af160b1ec1d574
|
[
"BSD-3-Clause"
] | 4
|
2019-07-31T13:52:59.000Z
|
2020-09-12T06:35:24.000Z
|
ctplanet/Hydrostatic.py
|
AlbertoJimenezDiaz/ctplanet
|
66651288abfb2c8588aec3bca1af160b1ec1d574
|
[
"BSD-3-Clause"
] | null | null | null |
ctplanet/Hydrostatic.py
|
AlbertoJimenezDiaz/ctplanet
|
66651288abfb2c8588aec3bca1af160b1ec1d574
|
[
"BSD-3-Clause"
] | 4
|
2018-10-30T04:36:55.000Z
|
2020-09-12T06:35:32.000Z
|
'''
Functions for calculating the shape of hydrostatic density interfaces and their
gravitational potential in a planet with a non-hydrostatic lithosphere.
'''
import numpy as np
import scipy.linalg.lapack as lapack
import pyshtools as pysh
# ==== HydrostaticShapeLith ====
def HydrostaticShapeLith(radius, rho, ilith, potential, topo, rho_surface,
r_sigma, omega, lmax, rp=None, mp=None, nmax=7):
"""
Calculate the shape of hydrostatic relief in a rotating planet or moon with
a non-hydrostatic lithosphere, along with the total gravitation potential
of the hydrostatic interfaces. For the case of a moon in synchronous
rotation, optionally include the tidal potential.
Returns
-------
hlm : array of SHCoeffs class instances, size(n+1)
Array of SHCoeffs class instances of the spherical harmonic
coefficients of the hydrostatic relief at each interface.
clm_hydro : SHCoeffs class instance containing the gravitational potential
resulting from all hydrostatic interfaces.
mass : float
Total mass of the planet, assuming a spherical shape and the provided
1D density profile.
Parameters
----------
radius : ndarray, float, size(n+1)
Radius of each density interface, where index 0 corresponds to the
center of the planet and n corresponds to the surface.
density : ndarray, float, size(n+1)
Density of layer i between radius[i] and radius[i+1]. The density
at index 0 is from the center of the planet to radius[1], whereas the
the density at index n should be zero.
ilith : int
Index of the interface that corresponds to the base of the lithosphere.
potential : SHGravCoeffs class instance
Observed gravitational potential coefficients.
topo : SHCoeffs class instance
Observed shape of the planet.
rho_surface : float
Effective density of the surface relief.
r_sigma : float
Radius of the mass sheet source in the lithosphere.
omega : float
Angular rotation rate of the planet.
lmax : int
Maximum spherical harmonic degree to compute for the hydrostatic
relief at each interface.
rp : float, optional, default = None
If specified, include the tidal potential acting on a synchronously
rotating moon, where rp is the average distance between the planet
and satellite.
mp : float, optional, default = None
The mass of the host planet, at a distance rp from the satellite.
nmax : int, optional, default = 7
The order of the approximation when computing the gravitational
potential of the surface.
"""
tides = False
if rp is not None:
if mp is None:
raise ValueError('When including tides, both rp and mp must be ' +
'specified.')
tides = True
if mp is not None:
if rp is None:
raise ValueError('When including tides, both rp and mp must be ' +
'specified.')
tides = True
if len(radius) != len(rho):
raise('Length of radius and density must be the same.' +
'len(radius) = {:d}. len(density) = {:d}.'
.format(len(radius), len(rho)))
n = len(radius) - 1 # index of surface
lmaxgrid = 3*lmax # increase grid size to avoid aliasing
g = pysh.constants.G.value
gm = potential.gm
r_ref = potential.r0
hlm = [pysh.SHCoeffs.from_zeros(lmax) for i in range(ilith+1)]
clm_hydro = pysh.SHCoeffs.from_zeros(lmax)
for i in range(ilith+1):
hlm[i].coeffs[0, 0, 0] = radius[i]
# First determine the spherical harmonic coefficients of (Y20 Ylm)
# and for tides, (Y22 Ylm). We are only concerned with the coefficient
# that corresponds to lm, so for each lm, store only the lm component in
# the array cp20 and cp22.
sh20 = np.zeros((2, lmax+1, lmax+1))
sh22 = np.zeros((2, lmax+1, lmax+1))
sh = np.zeros((2, lmax+1, lmax+1))
cp20 = np.zeros((2, lmax+1, lmax+1))
cp22 = np.zeros((2, lmax+1, lmax+1))
sh20[0, 2, 0] = 1. # Y20
sh22[0, 2, 2] = 1. # Y22
for l in range(1, lmax+1):
for m in range(0, l+1):
sh[0, l, m] = 1.
coeffs = pysh.expand.SHMultiply(sh20, sh)
cp20[0, l, m] = coeffs[0, l, m]
if m != 0:
cp20[1, l, m] = cp20[0, l, m]
if l == 2 and m == 0:
p402020 = coeffs[0, 4, 0]
if l == 2 and m == 1:
p412021 = coeffs[0, 4, 1]
if l == 2 and m == 2:
p422022 = coeffs[0, 4, 2]
coeffs = pysh.expand.SHMultiply(sh22, sh)
cp22[0, l, m] = coeffs[0, l, m]
sh[0, l, m] = 0.
if m > 0:
sh[1, l, m] = 1.
coeffs = pysh.expand.SHMultiply(sh22, sh)
cp22[1, l, m] = coeffs[1, l, m]
sh[1, l, m] = 0.
# Calculate delta_rho
drho = np.zeros(n+1)
mass = np.zeros(n+1)
for i in range(1, n):
drho[i] = rho[i-1] - rho[i]
drho[n] = rho_surface # Effective density of the surface layer
a = np.zeros((ilith+2, ilith+2))
atides = np.zeros((2, ilith+1))
b4 = np.zeros((2, 3, ilith+1))
# Calculate cumulate mass function
for i in range(1, n+1):
if i == 1:
mass[1] = 4. * np.pi * radius[1]**3 * rho[0] / 3.
else:
mass[i] = mass[i-1] + 4. * np.pi * \
(radius[i]**3 - radius[i-1]**3) * rho[i-1] / 3.
mass_model = mass[n]
# Calculate potential coefficients of the surface relief
grid = topo.expand(grid='DH2', lmax=lmaxgrid, lmax_calc=lmax, extend=False)
cplus, r_surface = pysh.gravmag.CilmPlusDH(grid.data, nmax, gm/g,
rho_surface, lmax=lmax)
cminus, r_surface = pysh.gravmag.CilmMinusDH(grid.data, nmax, gm/g,
rho_surface, lmax=lmax)
# Calculate matrix A and invert for relief.
for l in range(1, lmax+1):
for m in range(0, lmax+1):
for i in range(1, ilith+1): # zero index not computed
for j in range(1, ilith+1):
if i == j: # cp20 for sin and cosine terms are equal
a[i, j] = 4. * np.pi * g * drho[i] * radius[i] / \
(2. * l + 1.) - g * mass[i] / radius[i]**2 + \
(2./3.) * radius[i] * omega**2 * \
(1. - cp20[0, l, m] / np.sqrt(5.0))
elif j < i:
a[i, j] = 4. * np.pi * g * drho[j] / (2. * l + 1.) \
* radius[j] * (radius[j] / radius[i])**(l+1)
else:
a[i, j] = 4. * np.pi * g * drho[j] / (2. * l + 1.) \
* radius[i] * (radius[i] / radius[j])**(l-1)
a[i, ilith+1] = 4. * np.pi * g / (2. * l + 1.) \
* radius[i] * (radius[i] / r_sigma)**(l-1)
if tides is True:
atides[0, i] = g * mp * radius[i] / rp**3 * (
- np.sqrt(5.) / 5. * cp20[0, l, m] +
np.sqrt(12./5.) * cp22[0, l, m] / 2.)
atides[1, i] = g * mp * radius[i] / rp**3 * (
- np.sqrt(5.) / 5. * cp20[1, l, m] +
np.sqrt(12./5.) * cp22[1, l, m] / 2.)
for j in range(1, ilith+1):
a[ilith+1, j] = 4. * np.pi * g * drho[j] / (2. * l + 1.) \
* radius[j] * (radius[j] / r_ref)**(l+1)
a[ilith+1, ilith+1] = 4. * np.pi * g / (2. * l + 1.)\
* r_sigma * (r_sigma / r_ref)**(l+1)
# --- do cosine term ---
b = np.zeros(ilith+2)
if l == 2 and m == 0:
for i in range(1, ilith+1):
b[i] = (omega * radius[i])**2 / (3. * np.sqrt(5.))
if tides:
b[i] += g * mp * radius[i]**2 / rp**3 * \
np.sqrt(5.) / 10.
if l == 2 and m == 2 and tides:
for i in range(1, ilith+1):
b[i] = - g * mp * radius[i]**2 / rp**3 * \
np.sqrt(12./5.) / 4.
# Add contributions from degree 2 relief to degree 4.
if l == 4 and m <= 2:
b[1:ilith+1] = b4[0, m, 1:ilith+1]
for i in range(1, ilith+1):
b[i] -= gm * cminus[0, l, m] * (radius[i] / r_surface)**l \
/ r_surface
b[ilith+1] = gm * potential.coeffs[0, l, m] / r_ref - \
gm * cplus[0, l, m] * (r_surface / r_ref)**l / r_ref
# solve the linear equation A h = b
atemp = a.copy()
if tides:
for i in range(1, ilith+1):
atemp[i, i] += atides[0, i]
btemp = b.copy()
# note that the zero index is not used
lu, piv, x, info = lapack.dgesv(atemp[1:, 1:], btemp[1:])
if info != 0:
raise("lapack.dgesv did not exit properly: {:d}", info)
for i in range(1, ilith+1):
hlm[i].coeffs[0, l, m] = x[i-1]
# calculate b4 contribution
if l == 2:
for i in range(1, ilith+1):
if m == 0:
b4[0, m, i] = 2. / 3. / np.sqrt(5.) * \
omega**2 * radius[i] * \
hlm[i].coeffs[0, l, m] * p402020
elif m == 1:
b4[0, m, i] = 2. / 3. / np.sqrt(5.) * \
omega**2 * radius[i] * \
hlm[i].coeffs[0, l, m] * p412021
elif m == 2:
b4[0, m, i] = 2. / 3. / np.sqrt(5.) * \
omega**2 * radius[i] * \
hlm[i].coeffs[0, l, m] * p422022
# --- do sine term ---
b = np.zeros(ilith+2)
if m != 0:
# Add contributions from degree 2 relief to degree 4.
if l == 4 and m <= 2:
b[1:ilith+1] = b4[1, m, 1:ilith+1]
for i in range(1, ilith+1):
b[i] -= gm * cminus[1, l, m] * (radius[i] / r_surface)**l \
/ r_surface
b[ilith+1] = gm * potential.coeffs[1, l, m] / r_ref - \
gm * cplus[1, l, m] * (r_surface / r_ref)**l / r_ref
# solve the linear equation A h = b
atemp = a.copy()
if tides:
for i in range(1, ilith+1):
atemp[i, i] += atides[1, i]
btemp = b.copy()
# note that the zero index is not used
lu, piv, x, info = lapack.dgesv(atemp[1:, 1:], btemp[1:])
if info != 0:
raise("lapack.dgesv did not exit properly: {:d}", info)
for i in range(1, ilith+1):
hlm[i].coeffs[1, l, m] = x[i-1]
# calculate b4 contribution
if l == 2:
for i in range(1, ilith+1):
if m == 1:
b4[1, m, i] = 2. / 3. / np.sqrt(5.) * \
omega**2 * radius[i] * \
hlm[i].coeffs[1, l, m] * p412021
elif m == 2:
b4[1, m, i] = 2. / 3. / np.sqrt(5.) * \
omega**2 * radius[i] * \
hlm[i].coeffs[1, l, m] * p422022
# Calculate potential at r_ref resulting from all interfaces below and
# including ilith
coeffs = np.zeros((2, lmax+1, lmax+1))
for i in range(1, ilith+1):
for l in range(1, lmax+1):
coeffs[:, l, :l+1] += hlm[i].coeffs[:, l, :l+1] * 4. * \
np.pi * drho[i] * radius[i]**2 * (radius[i] / r_ref)**l * \
g / gm / (2. * l + 1.)
clm_hydro = pysh.SHGravCoeffs.from_array(coeffs, gm=gm, r0=r_ref,
omega=omega)
return hlm, clm_hydro, mass_model
def HydrostaticShape(radius, rho, omega, gm, r_ref, rp=None, mp=None,
i_clm_hydro=None):
"""
Calculate the shape of hydrostatic relief in a rotating planet or moon,
along with the total gravitation potential. For the case of a moon in
synchronous rotation, optionally include the tidal potential.
Returns
-------
hlm : array of SHCoeffs class instances, size(n+1)
Array of SHCoeffs class instances of the spherical harmonic
coefficients of the hydrostatic relief at each interface.
clm_hydro : SHCoeffs class instance containing the gravitational potential
resulting from all hydrostatic interfaces. If i_clm_hydro is specified,
then the potential will include only interfaces beneath index
i_clm_hydro.
mass : float
Total mass of the planet, assuming a spherical shape and the provided
1D density profile.
Parameters
----------
radius : ndarray, float, size(n+1)
Radius of each density interface, where index 0 corresponds to the
center of the planet and n corresponds to the surface.
density : ndarray, float, size(n+1)
Density of layer i between radius[i] and radius[i+1]. The density
at index 0 is from the center of the planet to radius[1], whereas the
the density at index n should be zero.
omega : float
Angular rotation rate of the planet.
gm : float
GM of the planet.
r_ref : float
Refernce radius for output potential coefficients.
rp : float, optional, default = None
If specified, include the tidal potential acting on a synchronously
rotating moon, where rp is the average distance between the planet
and satellite.
mp : float, optional, default = None
The mass of the host planet, at a distance rp from the satellite.
i_clm_hydro : int, optional, default = None
If specified, calculate the gravitational potential clm_hydro resulting
from all interfaces below and including the radius index i_clm_hydro.
"""
tides = False
if rp is not None:
if mp is None:
raise ValueError('When including tides, both rp and mp must be ' +
'specified.')
tides = True
if mp is not None:
if rp is None:
raise ValueError('When including tides, both rp and mp must be ' +
'specified.')
tides = True
if len(radius) != len(rho):
raise('Length of radius and density must be the same.' +
'len(radius) = {:d}. len(density) = {:d}.'
.format(len(radius), len(rho)))
n = len(radius) - 1 # index of surface
lmax = 4
g = pysh.constants.G.value
hlm = [pysh.SHCoeffs.from_zeros(lmax) for i in range(n+1)]
clm_hydro = pysh.SHCoeffs.from_zeros(lmax)
for i in range(n+1):
hlm[i].coeffs[0, 0, 0] = radius[i]
# First determine the spherical harmonic coefficients of (Y20 Ylm)
# and for tides, (Y22 Ylm). We are only concerned with the coefficient
# that corresponds to lm, so for each lm, store only the lm component in
# the array cp20 and cp22.
sh20 = np.zeros((2, lmax+1, lmax+1))
sh22 = np.zeros((2, lmax+1, lmax+1))
sh = np.zeros((2, lmax+1, lmax+1))
cp20 = np.zeros((2, lmax+1, lmax+1))
cp22 = np.zeros((2, lmax+1, lmax+1))
sh20[0, 2, 0] = 1. # Y20
sh22[0, 2, 2] = 1. # Y22
for l in range(2, lmax+1):
for m in range(0, l+1):
sh[0, l, m] = 1.
coeffs = pysh.expand.SHMultiply(sh20, sh)
cp20[0, l, m] = coeffs[0, l, m]
if m != 0:
cp20[1, l, m] = cp20[0, l, m]
if l == 2 and m == 0:
p402020 = coeffs[0, 4, 0]
if l == 2 and m == 1:
p412021 = coeffs[0, 4, 1]
if l == 2 and m == 2:
p422022 = coeffs[0, 4, 2]
coeffs = pysh.expand.SHMultiply(sh22, sh)
cp22[0, l, m] = coeffs[0, l, m]
sh[0, l, m] = 0.
if m > 0:
sh[1, l, m] = 1.
coeffs = pysh.expand.SHMultiply(sh22, sh)
cp22[1, l, m] = coeffs[1, l, m]
sh[1, l, m] = 0.
# Calculate delta_rho
drho = np.zeros(n+1)
mass = np.zeros(n+1)
for i in range(1, n+1):
drho[i] = rho[i-1] - rho[i]
# Calculate matrix A and invert for relief.
a = np.zeros((n+1, n+1))
atides = np.zeros((2, n+1))
b4 = np.zeros((2, 3, n+1))
# Calculate cumulate mass function
for i in range(1, n+1):
if i == 1:
mass[1] = 4. * np.pi * radius[1]**3 * rho[0] / 3.
else:
mass[i] = mass[i-1] + 4. * np.pi * \
(radius[i]**3 - radius[i-1]**3) * rho[i-1] / 3.
mass_model = mass[n]
for l in range(2, lmax+1, 2):
for m in range(0, lmax+1):
for i in range(1, n+1): # zero index not computed
for j in range(1, n+1):
if i == j: # cp20 for sin and cosine terms are equal
a[i, j] = 4. * np.pi * g * drho[i] * radius[i] / \
(2. * l + 1.) - g * mass[i] / radius[i]**2 + \
(2./3.) * radius[i] * omega**2 * \
(1. - cp20[0, l, m] / np.sqrt(5.0))
elif j < i:
a[i, j] = 4. * np.pi * g * drho[j] * radius[j] * \
(radius[j] / radius[i])**(l+1) / (2. * l + 1.)
else:
a[i, j] = 4. * np.pi * g * drho[j] * radius[i] * \
(radius[i] / radius[j])**(l-1) / (2. * l + 1.)
if tides is True:
atides[0, i] = g * mp * radius[i] / rp**3 * (
- np.sqrt(5.) / 5. * cp20[0, l, m] +
np.sqrt(12./5.) * cp22[0, l, m] / 2.)
atides[1, i] = g * mp * radius[i] / rp**3 * (
- np.sqrt(5.) / 5. * cp20[1, l, m] +
np.sqrt(12./5.) * cp22[1, l, m] / 2.)
# --- do cosine term ---
b = np.zeros(n+1)
if l == 2 and m == 0:
for i in range(1, n+1):
b[i] = (omega * radius[i])**2 / (3. * np.sqrt(5.))
if tides:
b[i] += g * mp * radius[i]**2 / rp**3 * \
np.sqrt(5.) / 10.
if l == 2 and m == 2 and tides:
for i in range(1, n+1):
b[i] = - g * mp * radius[i]**2 / rp**3 * \
np.sqrt(12./5.) / 4.
# Add contributions from degree 2 relief to degree 4.
if l == 4 and m <= 2:
b[1:n+1] = b4[0, m, 1:n+1]
# solve the linear equation A h = b
atemp = a.copy()
if tides:
for i in range(1, n+1):
atemp[i, i] += atides[0, i]
btemp = b.copy()
# note that the zero index is not used
lu, piv, x, info = lapack.dgesv(atemp[1:, 1:], btemp[1:])
if info != 0:
raise("lapack.dgesv did not exit properly: {:d}", info)
for i in range(1, n+1):
hlm[i].coeffs[0, l, m] = x[i-1]
# calculate b4 contribution
if l == 2:
for i in range(1, n+1):
if m == 0:
b4[0, m, i] = 2. / 3. / np.sqrt(5.) * \
omega**2 * radius[i] * \
hlm[i].coeffs[0, l, m] * p402020
elif m == 1:
b4[0, m, i] = 2. / 3. / np.sqrt(5.) * \
omega**2 * radius[i] * \
hlm[i].coeffs[0, l, m] * p412021
elif m == 2:
b4[0, m, i] = 2. / 3. / np.sqrt(5.) * \
omega**2 * radius[i] * \
hlm[i].coeffs[0, l, m] * p422022
# --- do sine term ---
b = np.zeros(n+1)
if m != 0:
# Add contributions from degree 2 relief to degree 4.
if l == 4 and m <= 2:
b[1:n+1] = b4[1, m, 1:n+1]
# solve the linear equation A h = b
atemp = a.copy()
if tides:
for i in range(1, n+1):
atemp[i, i] += atides[1, i]
btemp = b.copy()
# note that the zero index is not used
lu, piv, x, info = lapack.dgesv(atemp[1:, 1:], btemp[1:])
if info != 0:
raise("lapack.dgesv did not exit properly: {:d}", info)
for i in range(1, n+1):
hlm[i].coeffs[1, l, m] = x[i-1]
# calculate b4 contribution
if l == 2:
for i in range(1, n+1):
if m == 1:
b4[1, m, i] = 2. / 3. / np.sqrt(5.) * \
omega**2 * radius[i] * \
hlm[i].coeffs[1, l, m] * p412021
elif m == 2:
b4[1, m, i] = 2. / 3. / np.sqrt(5.) * \
omega**2 * radius[i] * \
hlm[i].coeffs[1, l, m] * p422022
# Calculate potential at r_ref resulting from all interfaces,
# or only those beneath and including i_clm_hydro.
coeffs = np.zeros((2, lmax+1, lmax+1))
if i_clm_hydro is None:
i_clm_hydro = n
for i in range(1, i_clm_hydro+1):
for l in range(2, lmax+1):
coeffs[:, l, :l+1] += hlm[i].coeffs[:, l, :l+1] * 4. * \
np.pi * drho[i] * radius[i]**2 * (radius[i] / r_ref)**l * \
g / gm / (2. * l + 1.)
coeffs[0, 0, 0] = 1.
clm_hydro = pysh.SHGravCoeffs.from_array(coeffs, gm=gm, r0=r_ref,
omega=omega)
return hlm, clm_hydro, mass_model
| 39.273043
| 79
| 0.462227
| 3,158
| 22,582
| 3.281507
| 0.079481
| 0.010422
| 0.024703
| 0.031844
| 0.85757
| 0.835279
| 0.818392
| 0.791759
| 0.7741
| 0.760977
| 0
| 0.059825
| 0.409308
| 22,582
| 574
| 80
| 39.341463
| 0.71707
| 0.262244
| 0
| 0.84438
| 0
| 0
| 0.034185
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.005764
| false
| 0
| 0.008646
| 0
| 0.020173
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 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
| 7
|
51d1a6a092ee373d0669a282b65b0270b3008598
| 680
|
py
|
Python
|
python--exercicios/ex027.py
|
Eliezer2000/python
|
12abb54c6536acb2f36b8f34bf51ec765857eb75
|
[
"MIT"
] | null | null | null |
python--exercicios/ex027.py
|
Eliezer2000/python
|
12abb54c6536acb2f36b8f34bf51ec765857eb75
|
[
"MIT"
] | null | null | null |
python--exercicios/ex027.py
|
Eliezer2000/python
|
12abb54c6536acb2f36b8f34bf51ec765857eb75
|
[
"MIT"
] | null | null | null |
n = str(input('Digite seu nome : ')).strip()
print('Muito prazer em te conhecer ! ')
nome = n.split()
print('O seu primeiro nome é: {}'.format(nome[0]))
print('O seu último nome é: {}'.format(nome[len(nome)-1]))
#n = str(input('Digite seu nome completo : ')).strip()
#print('Olá! Prazer em te conhecer ! ')
#nome = n.split()
#print('O seu primeiro nome é: {} '.format(nome[0]))
#print('O seu último nome é: {}'.format(nome[len(nome)-1]))
#n = str(input('Digite seu nome completo : '))
#print('Ola seja Bem-vindo! Muito prazer em te conhecer ! ')
#nome = n.split()
#print('O seu primeiro nome é: {}'.format(nome[0]))
#print('O seu último nome é: {}'.format(nome[len(nome)-1]))
| 34
| 60
| 0.635294
| 113
| 680
| 3.823009
| 0.247788
| 0.083333
| 0.125
| 0.208333
| 0.900463
| 0.900463
| 0.849537
| 0.849537
| 0.849537
| 0.849537
| 0
| 0.010292
| 0.142647
| 680
| 19
| 61
| 35.789474
| 0.730703
| 0.652941
| 0
| 0
| 0
| 0
| 0.426667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.6
| 0
| 0
| 0
| null | 0
| 0
| 1
| 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
| 1
|
0
| 8
|
51dc31ed2ec1fa0acd2e376926c9c8b9a24b3c48
| 80
|
py
|
Python
|
ksa_vat/jinja/utils.py
|
Craftint/ksa_vat
|
1939d4fc1eafc2ce62e3297eeb6dacbdd906c1f8
|
[
"MIT"
] | 21
|
2021-07-17T10:24:41.000Z
|
2021-12-16T13:29:05.000Z
|
ksa_vat/jinja/utils.py
|
Craftint/ksa_vat
|
1939d4fc1eafc2ce62e3297eeb6dacbdd906c1f8
|
[
"MIT"
] | 7
|
2021-11-03T11:52:45.000Z
|
2021-12-28T08:41:54.000Z
|
ksa_vat/jinja/utils.py
|
Craftint/ksa_vat
|
1939d4fc1eafc2ce62e3297eeb6dacbdd906c1f8
|
[
"MIT"
] | 28
|
2021-07-31T08:13:34.000Z
|
2022-03-15T06:16:28.000Z
|
import json
def string_to_json(json_string):
return json.loads(json_string)
| 20
| 34
| 0.8
| 13
| 80
| 4.615385
| 0.538462
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 80
| 4
| 34
| 20
| 0.857143
| 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 | 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
| 1
| 1
| 1
| 0
|
0
| 7
|
51f8183ccb834afc1b1fba61b1bca1778ad7e2ca
| 106
|
py
|
Python
|
azure_eventhubs_client/__init__.py
|
KnockriInc/azure_eventhubs_client
|
6c1d63ac1034ea47cf7cf3386348544146557111
|
[
"MIT"
] | 1
|
2019-04-03T15:32:36.000Z
|
2019-04-03T15:32:36.000Z
|
build/lib/azure_eventhubs_client/__init__.py
|
KnockriInc/azure_eventhubs_client
|
6c1d63ac1034ea47cf7cf3386348544146557111
|
[
"MIT"
] | null | null | null |
build/lib/azure_eventhubs_client/__init__.py
|
KnockriInc/azure_eventhubs_client
|
6c1d63ac1034ea47cf7cf3386348544146557111
|
[
"MIT"
] | 1
|
2019-03-29T19:39:13.000Z
|
2019-03-29T19:39:13.000Z
|
from azure_eventhubs_client.consumer import Consumer
from azure_eventhubs_client.producer import Producer
| 35.333333
| 52
| 0.90566
| 14
| 106
| 6.571429
| 0.5
| 0.195652
| 0.391304
| 0.521739
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.075472
| 106
| 2
| 53
| 53
| 0.938776
| 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
| 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
| 1
| 0
|
0
| 7
|
5c5383f5ead4b3035a615afac4215914efe1bcdb
| 109
|
py
|
Python
|
recipes/Python/577269_Import_modules/recipe-577269.py
|
tdiprima/code
|
61a74f5f93da087d27c70b2efe779ac6bd2a3b4f
|
[
"MIT"
] | 2,023
|
2017-07-29T09:34:46.000Z
|
2022-03-24T08:00:45.000Z
|
recipes/Python/577269_Import_modules/recipe-577269.py
|
unhacker/code
|
73b09edc1b9850c557a79296655f140ce5e853db
|
[
"MIT"
] | 32
|
2017-09-02T17:20:08.000Z
|
2022-02-11T17:49:37.000Z
|
recipes/Python/577269_Import_modules/recipe-577269.py
|
unhacker/code
|
73b09edc1b9850c557a79296655f140ce5e853db
|
[
"MIT"
] | 780
|
2017-07-28T19:23:28.000Z
|
2022-03-25T20:39:41.000Z
|
relative_to_current = lambda *x: __import__('os').path.join(__import__('os').path.dirname(__file__), *x)
| 54.5
| 108
| 0.715596
| 15
| 109
| 4.266667
| 0.733333
| 0.25
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.091743
| 109
| 1
| 109
| 109
| 0.646465
| 0
| 0
| 0
| 0
| 0
| 0.036697
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 1
| null | null | 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.